Getting a chat token

A chat token can be obtained in two ways:

  1. At the moment of chat initialization, using the data from the SDK configuration
  2. Via an API method

The second way is useful when you need to send messages to clients who have not written to the chat yet

Get a chat token

POST https://secure.usedesk.ru/uapi/v2/createChat

* — required parameter

Parameter Description
api_token* Channel API token
company_id* Company ID
channel_id* Identifier of the channel the request will be created in
name Client name
email Client email
phone Client phone
additional_id Additional client identifier
note Note text
avatar Image file
multipart/form-data
platform Platform
Possible values:
  • sdk

Request example:

{
    "api_token": "<channel API token>",
    "company_id": <company ID>,
    "channel_id": <channel ID>,
    "name": "BobbyJohn",
    "email": "boob@test.ru",
    "phone": "89513309769",
    "additional_id": 1125530,
    "note": "Great client",
    "avatar": "",
    "platform": "sdk"
}

On success the response contains the chat token:

{ 
    "status": "ok", 
    "chat_id": 12345, 
    "token": "<chat token>" 
}