Webhooks format for chats

All webhooks contain the X-Signature header that is calculated by the HMAC-SHA1 method. The channel secret is used as a secret key.
A webhook is generated for every message sent from the amoCRM interface via the chat channel. Webhook is sent only once and will not be sent again if the integration couldn’t process or receive it.
The response time on the webhook is also limited. We suggest only check the request signature when you receive the webhook and perform business logic in the background.

Webhook v1

Description

This webhook is sent if the v1 was set during the channel connection

Request parameters

Parameter Data type Description
receiver string Chat participant ID on the integration side
conversation_id string Chat ID on the integration side
type string Message type, one of the following: text, file, video, picture, voice, audio, sticker
media string Url to the file, video, picture, voice, audio, or sticker
thumbnail string Picture or video thumbnail url
file_name string The name of the file from the “media” field url
file_size int The size for the data in the “media” field

Request example

        
{
  "receiver": "b55770b5-974f-4dd6-8dd3-0356c08dc600",
  "conversation_id": "a4a5ab10-ea6f-4af4-8514-a8265e5c71bd",
  "type": "text",
  "text": "What is the best way to reach you?",
  "media": "",
  "thumbnail": "",
  "file_name": "",
  "file_size": 0
}
        
    

HTTP response codes

Response code Condition
200 Webhook processed successfully

Webhook v2

Description

This webhook is sent if the v2 was set during the channel connection

Request parameters

Parameter Data type Description
account_id string amojo account ID
time int Webhook generation timestamp is the format of Unix Timestamp
message[sender][id] string Chat participant amojo ID
message[receiver][id] string Chat participant ID on the integration side
message[receiver][phone] string The field is not returned if the profile wasn’t passed
message[receiver][email] string The field is not returned if the profile wasn’t passed
message[timestamp] int Message timestamp in the format of Unix Timestamp
message[id] string amojo ID of the message
message[type] string Message type, one of the following: text, file, video, picture, voice, audio, sticker
message[text] string The field is mandatory for the “text” type, can be empty for other types
message[media] string Url to the file, video, picture, voice, audio, or sticker
message[thumbnail] string Picture or video thumbnail url
message[file_name] string The name of the file from the “media” field url
message[file_size] int The size for the data in the “media” field

Request example

        
{
  "account_id": "af9945ff-1490-4cad-807d-945c15d88bec",
  "time": 1596470952,
  "message": {
    "receiver": {
      "id": "sk-1376265f-86df-4c49-a0c3-a4816df41af9",
      "phone": "14151112233",
      "email": "example.client@example.com"
    },
    "sender": {
      "id": "d8d9f9c4-9611-4794-a136-a253a13e1bb5"
    },
    "conversation": {
      "id": "skc-8e3e7640-49af-4448-a2c6-d5a421f7f217"
    },
    "timestamp": 1596470952,
    "message": {
      "id": "c0a83937-3ed9-4774-9582-77224f7b9117",
      "type": "picture",
      "text": "",
      "media": "https:\/\/about.gitlab.com\/images\/blogimages\/security-cover-new.png",
      "thumbnail": "",
      "file_name": "security-cover-new.png",
      "file_size": 223732
    }
  }
}
        
    

HTTP response codes

Response code Condition
200 Webhook processed successfully