Skip to content

Retrieves all chat messages.

Retrieves all chat messages

Method get.chat_messages_report
Description Retrieves all chat messages.
Who has access Partners and clients

Request parameters

Name Type Required Valid values Description
access_token string yes Authentication session key
user_id number no Unique user identifier of the agent client on behalf of which the request is made (Is required for the agent) To obtain a list of client users, you must use the method ""get.customer_users""
limit number no Number of records returned. See section "Paging"
offset number no Shift determines from which record number to return "limit" records. Default is "0". See section "Paging"
fields array no See "View of Returned Data"
sort array no See section "Sorting data"
chat_id number yes, if there are no chat_ids or date_from and date_till Unique chat ID
chat_ids array yes, if there is no chat_id or date_from and date_till List of unique chat IDs
date_from iso8601 yes, if no chat_id or chat_ids YYYY-MM-DD hh:mm:ss Start date and time of the reporting period. The date range cannot exceed 30 days. May be used together with chat_id or chat_ids.
date_till iso8601 yes, if no chat_id or chat_ids YYYY-MM-DD hh:mm:ss End date and time of the reporting period. The date range cannot exceed 30 days. May be used together with chat_id or chat_ids.

Response parameters

Name Type Valid values Filtering Sorting Answer by default Description
id number yes yes Unique message identifier
chat_id number yes yes Unique chat ID, see method "get.chats_report"
channel_id number yes Unique chat channel ID. Use together with a date or chat_id filter.
channel_type enum comagic yandex.dialogs dataapi whatsapp telegram vkontakte_groups viber telegram_private realty_yandex avito auto_ru facebook offline_message instagram waba yes yes Channel type. Must be used in conjunction with a filter by date or chat_id
date_time iso8601 YYYY-MM-DD hh:mm:ss yes yes Date and time when it was sent message (All messages must be in the order they were sent, i.e. sorted by field "date_time")
is_group_chat boolean yes Indicates whether the chat is a group chat
visitor_id number yes Unique visitor ID
text string yes Message text
source enum system - System; operator - Operator; visitor - Visitor; retention - Holding messages; autoinvite - Auto-invitation; form_text - Information collection form; chat_channel - Messenger; chatbot - Chat bot; yes Message source
resource object yes Information about the sent file in the message: size - file size in bytes type - file type file_url - link to file file_name - file name mime_type - media type
Employee
employee_id number yes yes yes Unique employee identifier
employee_full_name string yes Last name First name Patronymic of the employee

Example request

{
"jsonrpc":"2.0",
"id":"number",
"method":"get.chat_messages_report",
"params":{
"access_token":"string",
"chat_id":"number",
"user_id":"number",
"offset":"number",
"limit":"number",
"filter":{
},
"sort":[
{
"field":"string",
"order":"string"
}
],
"fields":[
"string"
]

}
}

Example response

{
"jsonrpc":"2.0",
"id":"number",
"result":{
"metadata":{

},
"data":[
{
"id":"number",
"chat_id":"number",
"date_time":"iso8601",
"is_group_chat": "boolean",
"visitor_id": "number",
"text":"string",
"resource": {
"size": "number",
"type": "enum",
"file_url": "string",
"file_name": "string",
"mime_type": "string"
},
"source":"enum",
"employee_id":"number",
"employee_full_name":"string"
}
]
}
}

Possible errors

See the "Errors for get methods" section.