Skip to main content

Get chat messages list

Gets a list of 20 chat or dialog messages, depending on the FirstID and LastID specified

Function GetChatMessagesList(Val URL, Val ChatID, Val LastID = "", Val FirstID = "", Val Token = "") Export

ParameterCLI optionTypeRequiredDescription
URL--urlStringURL of webhook or a Bitrix24 domain, when token used
ChatID--chatString, NumberChat ID (as chatXXX) or User ID (as XXX)
LastID--lastString, NumberId of last message
FirstID--firstString, NumberID of first message
Token--tokenStringAccess token, when app auth method used

Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API


tip

Method at API documentation: im.dialog.messages.get


1C:Enterprise/OneScript code example
    URL    = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";
ChatID = "chat4";

Result = OPI_Bitrix24.GetChatMessagesList(URL, ChatID);

URL = "b24-ar17wx.bitrix24.by";
Token = "75d8c668006e9f06006b12e400000001000...";
UserID = 10;

Result = OPI_Bitrix24.GetChatMessagesList(URL, UserID, , 0, Token);
    oint bitrix24 GetChatMessagesList \
--url ""b24-ar17wx.bitrix24.by"" \
--chat "10" \
--first "0" \
--token "***"
Result
{
"result": {
"chat_id": 10,
"messages": [
{
"id": 4286,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T16:06:51+00:00",
"text": "Текст сообщения",
"unread": false,
"uuid": null,
"replaces": [],
"params": [],
"disappearing_date": null
},
{
"id": 4366,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T16:40:58+00:00",
"text": "Message text",
"unread": false,
"uuid": null,
"replaces": [],
"params": [],
"disappearing_date": null
},
{
"id": 4406,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T19:57:33+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4446,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T20:21:27+00:00",
"text": "Текст сообщения",
"unread": false,
"uuid": null,
"replaces": [],
"params": [],
"disappearing_date": null
},
{
"id": 4486,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T20:22:30+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4526,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-13T20:41:21+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4668,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-14T08:10:33+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4708,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-14T08:22:56+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4748,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-14T08:26:01+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4788,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-14T08:28:01+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
"disappearing_date": null
},
{
"id": 4828,
"chat_id": 10,
"author_id": 1,
"date": "2024-07-14T08:28:36+00:00",
"text": "Это сообщение было удалено",
"unread": false,
"uuid": null,
"replaces": [],
"params": {
"IS_DELETED": "Y"
},
...