Step 2: Connect chat channel

Description

🚧

Please be aware that you won't be able to execute this step described above directly in the API Reference section due to tool limitations: it is not possible to calculate required headers and send a request simultaneously.

To link a chat channel to an account, you should send a POST request with the channel_id and the account ID in the request body.

As a response, you will obtain a unique scope_id for this channel, which will be used later for sending messages. Once the chat channel is linked to the Kommo account, you will be able to manage messages and receive web hooks about outgoing messages.

🚧

The connection must be established after each installation of the integration in the account, as the channel is automatically disabled when the integration is disabled.

The request body will be included in the request twice: once as its body and another time as the body’s MD5, which will be included in the signature.

📘

You should write the body in your request the same way you did when calculating the headers.

Headers & Authorization type

The authorization process for the Chat API differs from other Kommo API methods. Unlike other methods, the Chat API does not require an Access Token for authorization; instead, you need to include specific headers in all requests.

General requirements for Chat API requests

  • All requests to the Chat API must be sent to the domain amojo.kommo.com and include the following headers: Date, Content-Type, Content-MD5, X-Signature.
  • The parameters should be included in the request body in JSON format.
  • The chat API has strict typing, so ensure that the expected argument type matches the parameter description.

🚧

It's important not to use a secret key in the frontend of the widget. Any requests using the secret key should only be made from the backend part of your application.

Data type header when the request is successful/in case of error

Content-Type: application/json

Response parameters

ParameterData TypeDescription
account_idstringChat participant ID on the Kommo side (amojo_id)
scope_idstringUUID, scope_id account for your channel
titlestringBot name
hook_api_versionstringThe Chat API version
Language