v1

latestOpenAPI 3.1.02026-07-241630614.2 KB

Get chat history

The method allows you to get a list of messages in a specific chat.

get/{scope_id}/chats/{conversation_id}/history

Path parameters

scope_idstring required

Scope ID, it is specific to your integration

conversation_idstring required

conversation_id can be obtained either when creating a chat via the chat creation method, or from the message webhook.

Query parameters

offsetinteger

Offset of the message selection (how many records from the beginning of the selection we skip)

limitinteger

Number of returned entities per query (Maximum – 50)

Headers

Datestring required

Date and time when the request was generated. The signature will be valid for 15 minutes from this Date. The date should be in the format “Thu, 01 Jan 2023 12:00:00 +0000” (RFC2822)

Content-typestring required

Request data type. Currently, only application/json is supported.

Content-MD5string

For the request body, it is necessary to calculate the MD5 hash and indicate it in the header in lowercase. At the same time, it is important to keep in mind that the request body is calculated as a stream of bytes without considering the end of JSON markup, and if there are “\n” or spaces at the end, they will also be taken into account. For GET requests, MD5 must also be calculated. Even if nothing is passed in the request body, MD5 will be obtained from an empty string.

X-Signaturestring

Signature of the request as a string. It is formed from the name of the method (GET/POST) in uppercase, with the values of the headers concatenated by “\n”. Header values ​​come in a specific order. If there is no header, an empty string is specified instead. Next, add the requested path from the URL without the protocol and domain (without GET parameters) to the line. The resulting string is calculated using HMAC-SHA1, and as a secret, we use the channel secret obtained during registration. The resulting hash in lowercase is indicated in the X-Signature header.

Response

200

Example response

{
  "messages": [
    {
      "timestamp": 1670930693,
      "msec_timestamp": 1670930693280,
      "sender": {
        "id": "XXXXXX-ec21-4463-965f-1fe1d4cd5b89",
        "name": "Harry Potter"
      },
      "receiver": {
        "id": "XXXXXXX-a3ab-4695-832c-919dbfc598ea",
        "client_id": "XXXXXXXXX-ec21-4463-965f-1fe1d4cd5a89",
        "name": "Adam",
        "avatar": "https://www.w3schools.com/w3images/avatar2.png",
        "phone": "+1234567890"
      },
      "message": {
        "id": "XXXXXXX-de79-468b-a923-9a7c88c733d7",
        "type": "picture",
        "text": "Hello from Kommo",
        "media": "https://amojo.kommo.com/attachments/XXXXXXX-d2eb-4bd8-b862-a67934927b38/14723c64-c40d-4efc-9f78-9625adac414c/zDCRN_logo-min.jpg",
        "thumbnail": "https://amojo.kommo.com/attachments/XXXXXXX-d2eb-4bd8-b862-a67934927b38/14723c64-c40d-4efc-9f78-9625adac414c/zDCRN_logo-min_320x200.jpg",
        "file_name": "logo-min.png",
        "file_size": 27107
      }
    }
  ]
}