---
updatedAt: 2026-07-17T11:38:33.000Z
agentTools:
  projectIndex: https://developers.kommo.com/llms.txt
---

# Import, send and edit messages

# Description

<Callout icon="🚧" theme="warn">
  ###

  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
</Callout>

# Send/import a message

This method allows you to send incoming and outgoing messages, or import messages that were sent in a third-party application.

<Image src="https://files.readme.io/5897a8f01743373457b53b41740c6d5b92190d470f2b61383e86a97668e4777a-Screenshot_2024-10-18_at_16.23.27.png" alt="Example of a message" align="center" caption="Example of a message" />

The method will generate a message and, if needed, the chat itself for the specified `msgid` and `conversation_id`.

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Message type
      </th>

      <th>
        Use case
      </th>

      <th>
        Parameters that should be passed
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **Incoming**

        _from:_ **client**
      </td>

      <td>
        A client sends a message to the connected channel
      </td>

      <td>
        Only the `payload[sender]` field is filled in, the `payload[receiver]` field is not sent
      </td>
    </tr>

    <tr>
      <td>
        **Outgoing**

        _from_: **Kommo user**<br />_to_: **client**
      </td>

      <td>
        A manager writes a message to the client, we can identify who sends the message
      </td>

      <td>
        The fields `payload[sender]`(information about the manager) and `payload[receiver]`(information about the client) are filled in. `amojo_id` of the user is passed to `payload[sender][ref_id]` (you can get it via <Anchor target="_blank" href="https://developers.kommo.com/reference/users-list">GET users list</Anchor> request applying`?with=amojo_id` query parameter).
      </td>
    </tr>

    <tr>
      <td>
        **Outgoing**

        _from:_ **integration bot**<br />_to:_  **client**
      </td>

      <td>
        A manager writes a message to the client, we can't identify who sends the message
      </td>

      <td>
        Fields `payload[sender]` (information about the bot) and `payload[receiver]` (information about the client) are filled in.
        The ID of the integration bot, which was received when registering the channel in the chat API, is passed to the `payload[sender][ref_id]` field.
      </td>
    </tr>
  </tbody>
</Table>

Using this API method, you can bulk import old messages into a chat.

We recommend performing the import without notifications to managers or creating an incoming lead for all messages except the last one (the most recent).

To do this, you should pass the body parameter `payload[silent]` a `true` value for all messages except for the last one that passes the `payload[silent]` a `false` value. This way, an incoming lead will be created for the last message, and only one notification will come. Thus we will not create unnecessary disturbance for the user.

```json Incoming message
{
  "event_type": "new_message",
  "payload": {
    "timestamp": 1639604761,
    "msec_timestamp": 1639604761694,
    "msgid": "my_int-5f2836a8ca475",
    "conversation_id": "my_int-d5a421f7f217",
    "sender": {
      "id": "my_int-1376265f-86df-4c49-a0c3-a4816df41af8",
      "avatar": "https://example.com/users/avatar.png",
      "profile": {
        "phone": "+1400000000",
        "email": "example.client@example.com"
      },
      "profile_link": "https://example.com/profile/example.client",
      "name": "Client name"
    },
    "message": {
      "type": "text",
      "text": "Message from a client"
    },
    "silent": false
  }
}
```
```json Outgoing message from a manager
{
  "event_type": "new_message",
  "payload": {
    "timestamp": 1639604903,
    "msec_timestamp": 1639604903161,
    "msgid": "my_int-5f2836a8ca476",
    "conversation_id": "my_int-d5a421f7f217",
    "sender": {
      "id": "my_int-manager1_user_id",
      "name": "Manager name",
      "ref_id": "76fc2bea-902f-425c-9a3d-dcdac4766090"
    },
    "receiver": {
      "id": "my_int-1376265f-86df-4c49-a0c3-a4816df41af8",
      "avatar": "https://example.com/users/avatar.png",
      "name": "Client name",
      "profile": {
        "phone": "+1400000000",
        "email": "example.client@example.com"
      },
      "profile_link": "https://example.com/profile/example.client"
    },
    "message": {
      "type": "text",
      "text": "Message from a manager 76fc2bea-902f-425c-9a3d-dcdac4766090"
    },
    "silent": true
  }
}
```
```json Outgoing message from a bot
{
  "event_type": "new_message",
  "payload": {
    "timestamp": 1639605194,
    "msec_timestamp": 1639605194102,
    "msgid": "my_int-5f2836a8ca477",
    "conversation_id": "my_int-d5a421f7f217",
    "sender": {
      "id": "my_int-bot_user_id",
      "name": "Bot",
      "ref_id": "f1910c7f-b1e0-4184-bd09-c7def2a9109a"
    },
    "receiver": {
      "id": "my_int-1376265f-86df-4c49-a0c3-a4816df41af8",
      "avatar": "https://example.com/users/avatar.png",
      "name": "Client name",
      "profile": {
        "phone": "+1400000000",
        "email": "example.client@example.com"
      },
      "profile_link": "https://example.com/profile/example.client"
    },
    "message": {
      "type": "text",
      "text": "Message from the channel bot f1910c7f-b1e0-4184-bd09-c7def2a9109a"
    },
    "silent": true
  }
}
```

When importing messages from the integration bot, hooks are not sent.

# Send a comment

The method also allows you to transfer incoming and outgoing comments (responses to comments that were sent in a third-party application).

The main difference between sending comments and sending messages is the addition of a post field to the request, which contains the post ID on the integration side.

```json Incoming comment from a client
{
    "event_type": "new_message",
    "payload": {
        "timestamp": 1639604761,
        "msec_timestamp": 1639604761694,
        "msgid": "my_int-5f2836a8ca475",
        "conversation_id": "my_int-d5a421f7f217",
        "sender": {
            "id": "my_int-1376265f-86df-4c49-a0c3-a4816df41af8",
            "avatar": "https://example.com/users/avatar.png",
            "profile": {
                "phone": "+1234567890",
                "email": "example.client@example.com"
            },
            "profile_link": "https://example.com/profile/example.client",
            "name": "Client name"
        },
        "message": {
            "type": "text",
            "text": "Message from the client",
            "post": {
                "id": "my-int-376265",
                "url": "https://www.example.com/@example/video/7490",
                "preview_url": "https://example/1/preview.png",
                "preview_permalink": "https://example/2/preview.png",
                "username": "post creator",
                "caption": "Post description"
            }
        },
        "silent": false
    }
}

```
```json Reply to a comment from a manager
{
    "event_type": "new_message",
    "payload": {
        "timestamp": 1639604903,
        "msec_timestamp": 1639604903161,
        "msgid": "my_int-5f2836a8ca476",
        "conversation_id": "my_int-d5a421f7f217",
        "sender": {
            "id": "my_int-manager1_user_id",
            "name": "Manager name",
            "ref_id": "76fc2bea-902f-425c-9a3d-dcdac4766090"
        },
        "receiver": {
            "id": "my_int-1376265f-86df-4c49-a0c3-a4816df41af8",
            "avatar": "https://example.com/users/avatar.png",
            "name": "Client name",
            "profile": {
                "phone": "+1234567890",
                "email": "example.client@example.com"
            },
            "profile_link": "https://example.com/profile/example.client"
        },
        "message": {
            "type": "text",
            "text": "Comment from a manager 76fc2bea-902f-425c-9a3d-dcdac4766090",
            "post": {
                "id": "my-int-376265",
                "url": "https://www.example.com/@example/video/7490",
                "preview_url": "https://example/1/preview.png",
                "preview_permalink": "https://example/2/preview.png",
                "username": "post creator",
                "caption": "Post description"
            }
        },
        "silent": true
    }
}

```

The method will create a comment and if necessary the chat itself for the specified `msgid` and `conversation_id` respectively. Comments will be created in the same chat with personal messages, but in different conversations. A conversation will be created containing all comments from the client for each commented post. The structure of the `receiver` and `sender` fields is the same for importing a common message.

# Edit a message

The method also allows you to edit messages sent to your clients. You need to pass `event_type`: `edit_message` in the message payload.

```json Edit a message
{
  "event_type": "edit_message",
  "payload": {
    "timestamp": 1639605194,
    "msec_timestamp": 1639605194102,
    "msgid": "my_int-5f2836a8ca477",
    "conversation_id": "my_int-d5a421f7f217",
    "message": {
      "type": "text",
      "text": "Edited message"
    }
  }
}
```

# Headers & Authorization type

| Parameter    | Data type | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| :----------- | :-------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Date         | string    | 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-type | string    | Request data type. Currently, only application/json is supported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Content-MD5  | string    | 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.                                                                                                                                                                                                                                     |
| X-Signature  | string    | 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. |

<Recipe slug="calculate-headers-for-chats-api-requests" title="Calculate headers for Chats API requests" />

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

Content-Type: application/json

# Response parameters

| Parameter                       | Date type | Description                                                                 |
| :------------------------------ | :-------- | :-------------------------------------------------------------------------- |
| new\_message\[msgid]            | string    | Message ID in the Chats API                                                 |
| new\_message\[ref\_id]          | string    | Message ID on the integration side                                          |
| new\_message\[conversation\_id] | string    | Chat ID in the Chats API                                                    |
| new\_message\[sender\_id]       | string    | Message sender ID in the Chats API                                          |
| new\_message\[receiver\_id]     | string    | Message receiver ID in the Chats API. Returned only for an outgoing message |

<br />

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "chats-api",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://amojo.kommo.com/v2/origin/custom/"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/{scope_id}": {
      "post": {
        "summary": "Import, send and edit messages",
        "description": "",
        "operationId": "send-import-messages",
        "parameters": [
          {
            "name": "Date",
            "in": "header",
            "description": "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)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-type",
            "in": "header",
            "description": "Request data type. Currently, only application/json is supported.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-MD5",
            "in": "header",
            "description": "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",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Signature",
            "in": "header",
            "description": "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.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope_id",
            "in": "path",
            "description": "You obtain it when connect a chat channel to the account (https://developers.kommo.com/reference/connect-channel)",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "RAW_BODY": {
                    "type": "object",
                    "properties": {
                      "event_type": {
                        "type": "string",
                        "description": "Event type (`new_message` and `edit_message` are available)",
                        "default": "new_message",
                        "enum": [
                          "new_message",
                          "edit_message"
                        ]
                      },
                      "payload": {
                        "type": "object",
                        "description": "An array contains the elements of the message.",
                        "required": [
                          "timestamp",
                          "msgid"
                        ],
                        "properties": {
                          "timestamp": {
                            "type": "integer",
                            "description": "Message timestamp in Unix Timestamp format",
                            "format": "int32"
                          },
                          "msec_timestamp": {
                            "type": "integer",
                            "description": "Message timestamp in milliseconds",
                            "format": "int32"
                          },
                          "msgid": {
                            "type": "string",
                            "description": "Chat message ID on the integration side"
                          },
                          "conversation_id": {
                            "type": "string",
                            "description": "Chat ID on the integration side"
                          },
                          "conversation_ref_id": {
                            "type": "string",
                            "description": "Chat ID on Kommo side. It should be sent if the client responds to a message sent with “Write first” so the chat on your side is associated with the chat on the system."
                          },
                          "source": {
                            "type": "object",
                            "description": "Message source.",
                            "properties": {
                              "external_id": {
                                "type": "string",
                                "description": "Chat source identifier on the integration side. The field length is 40 characters, you can use any printable ASCII characters and a space."
                              }
                            }
                          },
                          "sender": {
                            "type": "object",
                            "description": "Message sender",
                            "required": [
                              "id",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Chat participant ID on the integration side"
                              },
                              "ref_id": {
                                "type": "string",
                                "description": "Chat participant ID on the Chat API side"
                              },
                              "name": {
                                "type": "string",
                                "description": "Chat participant name"
                              },
                              "avatar": {
                                "type": "string",
                                "description": "Link to the chat participant’s avatar. The link must be available to third-party resources and provide an image for download"
                              },
                              "profile_link": {
                                "type": "string",
                                "description": "Link to the profile of the chat participant in a third-party chat system"
                              },
                              "profile": {
                                "type": "object",
                                "description": "Chat participant profile.",
                                "properties": {
                                  "phone": {
                                    "type": "string",
                                    "description": "Phone number. When creating an incoming lead, the phone number will be added to the contact data"
                                  },
                                  "email": {
                                    "type": "string",
                                    "description": "Email address. When creating an incoming lead, the email address will be added to the contact data"
                                  }
                                }
                              }
                            }
                          },
                          "receiver": {
                            "type": "object",
                            "description": "Message receiver",
                            "required": [
                              "id",
                              "name"
                            ],
                            "properties": {
                              "id": {
                                "type": "string",
                                "description": "Chat participant ID on the integration side"
                              },
                              "ref_id": {
                                "type": "string",
                                "description": "Chat participant ID on the Chat API side"
                              },
                              "name": {
                                "type": "string",
                                "description": "Chat participant name"
                              },
                              "avatar": {
                                "type": "string",
                                "description": "Link to the chat participant’s avatar. The link must be available to third-party resources and provide an image for download"
                              },
                              "profile_link": {
                                "type": "string",
                                "description": "Link to the profile of the chat participant in a third-party chat system"
                              },
                              "profile": {
                                "type": "object",
                                "description": "Chat participant profile.",
                                "properties": {
                                  "phone": {
                                    "type": "string",
                                    "description": "Phone number. When creating an incoming lead, the phone number will be added to the contact data"
                                  },
                                  "email": {
                                    "type": "string",
                                    "description": "Email address. When creating an incoming lead, the email address will be added to the contact data"
                                  }
                                }
                              }
                            }
                          },
                          "message": {
                            "type": "object",
                            "description": "An array contains the message components.",
                            "required": [
                              "type"
                            ],
                            "properties": {
                              "type": {
                                "type": "string",
                                "description": "Message type, one of the following: text, contact, file, video, picture, voice, audio, sticker, location",
                                "enum": [
                                  "text",
                                  "contact",
                                  "file",
                                  "video",
                                  "picture",
                                  "voice",
                                  "audio",
                                  "sticker",
                                  "location"
                                ]
                              },
                              "text": {
                                "type": "string",
                                "description": "The field is mandatory for the `text` type, can be empty for other types"
                              },
                              "media": {
                                "type": "string",
                                "description": "URL to the `file`, `video`, `picture`, `voice`, `audio`, or `sticker`. URL should be available for download. Optional field if the file does not change when editing the message."
                              },
                              "file_size": {
                                "type": "integer",
                                "description": "The size of the file from the `media` field (optional)",
                                "format": "int32"
                              },
                              "file_name": {
                                "type": "string",
                                "description": "The name of the file from the `media` field URL, the field is optional. Ignored for the `voice` type. Optional field if the file does not change when editing the message."
                              },
                              "media_duration": {
                                "type": "integer",
                                "description": "Optional. Duration for `video`/`audio`/`voice` messages"
                              },
                              "contact": {
                                "type": "object",
                                "description": "Mandatory fields for messages of type `contact` (contact information).",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "description": "Contact name"
                                  },
                                  "phone": {
                                    "type": "string",
                                    "description": "Contact phone"
                                  }
                                }
                              },
                              "location": {
                                "type": "object",
                                "description": "Mandatory fields for messages of type `location` (geoposition)",
                                "properties": {
                                  "lon": {
                                    "type": "number",
                                    "description": "Longitude",
                                    "format": "float"
                                  },
                                  "lat": {
                                    "type": "number",
                                    "description": "Latitude",
                                    "format": "float"
                                  }
                                }
                              },
                              "post": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "Unique post ID on the integration side"
                                  },
                                  "url": {
                                    "type": "string",
                                    "description": "Link to the post in the source"
                                  },
                                  "preview_url": {
                                    "type": "string",
                                    "description": "Link to preview if TTL links are limited. If preview_link is passed along with preview_permalink, preview_permalink will be used."
                                  },
                                  "preview_permalink\t": {
                                    "type": "string",
                                    "description": "Link to preview if the link is permanent. If preview_link is passed along with preview_permalink, preview_permalink will be used."
                                  },
                                  "username": {
                                    "type": "string",
                                    "description": "The user who published the post"
                                  },
                                  "caption": {
                                    "type": "string",
                                    "description": "Post description"
                                  }
                                },
                                "description": "Optional field. Must be passed for comments.",
                                "required": [
                                  "id",
                                  "url"
                                ]
                              },
                              "delivery_status": {
                                "type": "object",
                                "properties": {
                                  "status_code": {
                                    "type": "integer",
                                    "description": "Delivery status. Available statuses are described here: https://developers.kommo.com/reference/update-delivery-status"
                                  },
                                  "error_сode": {
                                    "type": "integer",
                                    "description": "Error type. Available error types are described here: https://es-developers.kommo.com/reference/actualizar-el-estado-de-entrega-del-mensaje"
                                  },
                                  "error": {
                                    "type": "string",
                                    "description": "Error text that will be displayed to the user."
                                  }
                                },
                                "description": "Optional. Message delivery status object, can be passed both for `edit_message` and `new_message` types"
                              },
                              "shared_post": {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string",
                                    "description": "Link to the post"
                                  },
                                  "preview_link": {
                                    "type": "string",
                                    "description": "Optional. Temporary link to the preview image. Used when the preview link is temporary and you need to download the image in Kommo."
                                  },
                                  "preview_permalink": {
                                    "type": "string",
                                    "description": "Optional. Permanent link to the preview image. Used when the preview link is permanent and you don't need to upload the image to Kommo."
                                  },
                                  "type": {
                                    "type": "string",
                                    "description": "Post type. Currently, currently only `post` value is supported",
                                    "enum": [
                                      "post"
                                    ]
                                  },
                                  "site_name": {
                                    "type": "string",
                                    "description": "Optional. Post caption."
                                  }
                                },
                                "description": "Optional. Post shared by the user."
                              },
                              "sticker_id": {
                                "type": "string",
                                "description": "Optional. A common identifier for the sticker being sent across all accounts."
                              },
                              "callback_data": {
                                "type": "string",
                                "description": "Optional. Must be passed to WhatsApp List Messages for the bot to be launched correctly."
                              }
                            }
                          },
                          "silent": {
                            "type": "boolean",
                            "description": "Defines whether to create an Incoming lead and send a notification for a message in your Kommo account. When editing a message, an Incoming lead is not created and no notification is sent.",
                            "default": "true"
                          },
                          "reply_to": {
                            "type": "object",
                            "description": "The object of the embedded message. The message from a quote with a reply can only belong to the same chat as the message being sent.",
                            "properties": {
                              "message": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "description": "The ID of the quoted message in the Chats API. If passed, the remaining fields do not need to be filled in, they will be determined automatically. In case of passing the ID, scrolling to the message will also work if the chat is in the same card."
                                  },
                                  "msgid": {
                                    "type": "string",
                                    "description": "The ID of the quoted message on the integration side. If passed, the remaining fields do not need to be filled in, they will be determined automatically. In case of passing the ID, scrolling to the message will also work if the chat is in the same card."
                                  },
                                  "type": {
                                    "type": "string",
                                    "description": "Mandatory if no ID is passed. Message type can be one of the following: text, contact, file, video, picture, voice, audio, sticker, location."
                                  },
                                  "text": {
                                    "type": "string",
                                    "description": "Mandatory for the \"text\" type if no ID is passed. For other message types, this can be empty."
                                  },
                                  "file_name": {
                                    "type": "string",
                                    "description": "Optional. File name"
                                  },
                                  "file_size": {
                                    "type": "integer",
                                    "description": "Optional. File size in bytes",
                                    "format": "int32"
                                  },
                                  "media_duration": {
                                    "type": "integer",
                                    "description": "Optional. Duration for video/audio/voice messages",
                                    "format": "int32"
                                  },
                                  "location": {
                                    "type": "object",
                                    "description": "Mandatory for location type messages if no ID is passed.",
                                    "properties": {
                                      "lon": {
                                        "type": "number",
                                        "description": "Longitude",
                                        "format": "float"
                                      },
                                      "lat": {
                                        "type": "number",
                                        "description": "Latitude",
                                        "format": "float"
                                      }
                                    }
                                  },
                                  "sender": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "description": "Sender ID on the integration side, if passed, the remaining fields do not need to be filled in, they will be determined automatically."
                                      },
                                      "ref_id": {
                                        "type": "string",
                                        "description": "Sender ID in the Chats API, if passed, the remaining fields do not need to be filled in, they will be determined automatically."
                                      },
                                      "name": {
                                        "type": "string",
                                        "description": "Mandatory if no ID is passed. Sender name"
                                      }
                                    }
                                  }
                                },
                                "description": "Required field. The object of the embedded message. A message from a quote with a reply can only belong to the same chat as the message being sent."
                              }
                            },
                            "required": []
                          },
                          "forwards": {
                            "type": "object",
                            "description": "Optional. The object of the forwarded quote.",
                            "properties": {
                              "messages": {
                                "type": "array",
                                "description": "Mandatory. An array of embedded message objects. Currently, it is only possible to forward one message. Messages from a forwarded quote can belong to any external chat within the integration.",
                                "items": {
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "description": "The ID of the quoted message in the Chats API. If passed, the remaining fields do not need to be filled in, they will be determined automatically. In case of passing the ID, scrolling to the message will also work if the chat is in the same card."
                                    },
                                    "msgid": {
                                      "type": "string",
                                      "description": "The ID of the quoted message on the integration side. If passed, the remaining fields do not need to be filled in, they will be determined automatically. In case of passing the ID, scrolling to the message will also work if the chat is in the same card."
                                    },
                                    "type": {
                                      "type": "string",
                                      "description": "Mandatory if no ID is passed. Message type can be one of the following: text, contact, file, video, picture, voice, audio, sticker, location."
                                    },
                                    "text": {
                                      "type": "string",
                                      "description": "Mandatory for the \"text\" type if no ID is passed. For other message types, this can be empty."
                                    },
                                    "file_name": {
                                      "type": "string",
                                      "description": "Optional. File name"
                                    },
                                    "file_size": {
                                      "type": "integer",
                                      "description": "Optional. File name"
                                    },
                                    "media_duration": {
                                      "type": "integer",
                                      "description": "Optional. Duration for video/audio/voice messages"
                                    },
                                    "location": {
                                      "type": "object",
                                      "properties": {
                                        "lon": {
                                          "type": "number",
                                          "description": "Longtitude",
                                          "format": "float"
                                        },
                                        "lat": {
                                          "type": "number",
                                          "description": "Latitude",
                                          "format": "float"
                                        }
                                      },
                                      "description": "Mandatory for location messages if an identifier is not provided."
                                    },
                                    "contact": {
                                      "type": "object",
                                      "description": "Mandatory for contact messages if ID is not provided.",
                                      "properties": {
                                        "name": {
                                          "type": "string",
                                          "description": "Mandatory. Contact name"
                                        },
                                        "phone": {
                                          "type": "string",
                                          "description": "Mandatory. Contact phone number"
                                        }
                                      }
                                    },
                                    "sender": {
                                      "type": "object",
                                      "description": "Mandatory if ID is not provided, message sender (short version).",
                                      "properties": {
                                        "id": {
                                          "type": "string",
                                          "description": "Sender ID on the integration side. If passed, the remaining fields are optional and will be defined automatically."
                                        },
                                        "ref_id": {
                                          "type": "string",
                                          "description": "Sender ID on the Chats API side. If passed, the remaining fields are optional and will be defined automatically."
                                        },
                                        "name": {
                                          "type": "string",
                                          "description": "Required if no ID is passed. Sender name"
                                        }
                                      }
                                    },
                                    "timestamp": {
                                      "type": "integer",
                                      "description": "Required if no ID is provided, message time, Unix timestamp."
                                    },
                                    "msec_timestamp": {
                                      "type": "integer",
                                      "description": "Required if no ID is provided, message time in milliseconds."
                                    }
                                  },
                                  "type": "object"
                                }
                              },
                              "conversation_ref_id": {
                                "type": "string",
                                "description": "Optional. Chat ID on the Chat API side. The chat must belong to the integration."
                              },
                              "conversation_id": {
                                "type": "string",
                                "description": "Optional. Chat ID on the integration side."
                              }
                            }
                          },
                          "delivery_status": {
                            "type": "object",
                            "properties": {
                              "status_code": {
                                "type": "integer",
                                "description": "Message delivery status. Available statuses are described here: https://developers.kommo.com/reference/update-delivery-status#message-status-codes",
                                "enum": [
                                  -1,
                                  1,
                                  2
                                ]
                              },
                              "error_сode": {
                                "type": "integer",
                                "description": "Error type. Required only if `\"status_code\": -1`. Available types are described here: https://developers.kommo.com/reference/update-delivery-status#error-codes",
                                "enum": [
                                  901,
                                  902,
                                  903,
                                  904,
                                  905
                                ]
                              },
                              "error": {
                                "type": "string",
                                "description": "Error text that will be displayed in Kommo interface. Required only if `\"status_code\": -1` and `\"error_code\": 905\"`"
                              }
                            },
                            "description": "The object allows you to set the message delivery status when sending it. If no object is passed, status `sent` is set for the message. More information on the object params: https://developers.kommo.com/reference/update-delivery-status"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "The message is accepted for processing": {
                    "value": {
                      "new_message": {
                        "conversation_id": "1697efa3-0d19-4859-ac12-317c444fb5de",
                        "sender_id": "7458347a-0012-4a16-a796-f670cea5f807",
                        "receiver_id": "0dd5cbcf-e564-4e37-a56a-100997b2d471",
                        "msgid": "184e1afd-af91-4774-b8d9-782dc459bc4b",
                        "ref_id": "msgid1"
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "new_message": {
                      "type": "object",
                      "properties": {
                        "conversation_id": {
                          "type": "string",
                          "example": "1697efa3-0d19-4859-ac12-317c444fb5de"
                        },
                        "sender_id": {
                          "type": "string",
                          "example": "7458347a-0012-4a16-a796-f670cea5f807"
                        },
                        "receiver_id": {
                          "type": "string",
                          "example": "0dd5cbcf-e564-4e37-a56a-100997b2d471"
                        },
                        "msgid": {
                          "type": "string",
                          "example": "184e1afd-af91-4774-b8d9-782dc459bc4b"
                        },
                        "ref_id": {
                          "type": "string",
                          "example": "msgid1"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Invalid data was given. Details are available in the response.": {
                    "value": {
                      "status": 0,
                      "error_code": 400,
                      "error_type": "VALIDATION_ERROR",
                      "error_description": "Request has invalid fields, please check documentation"
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "application/json": {
                "examples": {
                  "Incorrect request signature": {
                    "value": {
                      "status": 0,
                      "error_code": 403,
                      "error_type": "ORIGIN_INVALID_SIGNATURE",
                      "error_description": "invalid signature"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```