To begin using the Chat API, we need to retrieve the credentials from the Kommo account. In this section, we will acquire the Kommo chat service ID for both the account and the user.
Account
To work with the chat service, you need to acquire a unique account ID (amojo_id
). It is different from the client ID.
It can be obtained in two ways:
- Using the request to the Kommo API
- From the front-end with the JS script
API request
To obtain an account ID via an API request you should pass a value amojo_id
to with
parameter.
Example of the response
{
"id": 1111XXX,
"name": "Test account",
"amojo_id": "XXXXXXX-d2eb-4bd8-b862-b57934927b38",
}
From front-end
You can get the chat ID for the account while developing the UI/UX part of your integration by typing APP.constant('account').amojo_id
.
User
To import message history or add messages sent in a third-party application, you may need information about Kommo account users.
Or rather, their IDs in the Chat API since they differ from the ID used in other Kommo API methods.
It can be obtained in two ways:
- Using the request to the Kommo API
- From the front-end with the JS script
API request
To obtain user IDs via an API request you should pass a value amojo_id
to with
parameter.
Example of the response
{
"id": 1XXXXXXX,
"name": "Danny",
"amojo_id": "1234567-ec21-4463-965f-1fe1d4cd5b89"
}
From front-end
You can get the chat ID for the user while developing the UI/UX part of your integration by typing APP.constant('user').amojo_id
.