botruntime
API ReferenceChat API

Get Or Create User

Retrieves the [User](#schema_user) object for given discriminating tags. If the user does not exist, it will be created. If the user already exists, its name, pictureUrl, attributes, and tags will be updated with the provided values.

POST
/v1/chat/users/get-or-create

Header Parameters

x-bot-id*string

Bot id

x-integration-id?string

Integration id

x-integration-alias?string

Integration alias

Request Body

application/json

User data

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/chat/users/get-or-create" \  -H "x-bot-id: string" \  -H "Content-Type: application/json" \  -d '{    "tags": {      "property1": "string",      "property2": "string"    }  }'
{  "user": {    "id": "stringstringstringstringstri",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "tags": {      "property1": "string",      "property2": "string"    },    "name": "string",    "pictureUrl": "string",    "properties": {      "property1": "string",      "property2": "string"    },    "attributes": {      "property1": "string",      "property2": "string"    }  },  "meta": {    "created": true  }}
{  "user": {    "id": "stringstringstringstringstri",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "tags": {      "property1": "string",      "property2": "string"    },    "name": "string",    "pictureUrl": "string",    "properties": {      "property1": "string",      "property2": "string"    },    "attributes": {      "property1": "string",      "property2": "string"    }  },  "meta": {    "created": true  }}