For AI agents: markdown of this page — /docs-content-en/chats/messages/comments.md documentation index — /llms.txt
Comment summary for posts
GET /v1/chats/messages/comments
Returns a summary of the comment threads of the specified channel posts. A comment thread is a separate chat bound to the post.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ParametermessageIds (query) |
Typestring | Requiredyes | Default— | DescriptionComma-separated IDs of posts from one channel, 1 to 100 IDs: 845,846. Posts of a channel — Read messages |
Any other parameter, or messageIds given more than once, is rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/chats/messages/comments?messageIds=845,846" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/chats/messages/comments?messageIds=845,846" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/comments?messageIds=845,846', {
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log('Posts with comments:', data.commentInfo.map((c) => c.messageId))
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/comments?messageIds=845,846', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
console.log('Posts with comments:', data.commentInfo.map((c) => c.messageId))
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata.commentInfo |
Typearray | DescriptionOne item per post that has a comment thread |
Fielddata.commentInfo[].messageId |
Typenumber | DescriptionPost ID |
Fielddata.commentInfo[].chatId |
Typenumber | DescriptionID of the comment chat |
Fielddata.commentInfo[].dialogId |
Typestring | DescriptionDialog ID of the comment chat, chatXXX. Comments of the thread — Read messages |
Fielddata.commentInfo[].messageCount |
Typenumber | DescriptionNumber of messages in the thread. A thread opens with a system message, so a thread without comments shows 1 here |
Fielddata.commentInfo[].lastUserIds |
Typearray | DescriptionIDs of the latest commenters. Their details are in data.usersShort |
Fielddata.commentInfo[].isUserSubscribed |
Typeboolean | Descriptiontrue — you follow the comments of the post |
Fielddata.usersShort |
Typearray | DescriptionBrief details of the commenters |
Fielddata.usersShort[].id |
Typenumber | DescriptionUser ID |
Fielddata.usersShort[].name |
Typestring | DescriptionUser name |
Fielddata.usersShort[].avatar |
Typestring | DescriptionAvatar URL |
Fielddata.usersShort[].color |
Typestring | DescriptionThe user's color in the messenger, #rrggbb |
Fielddata.usersShort[].type |
Typestring | DescriptionUser type, for example user |
Response example
{
"success": true,
"data": {
"usersShort": [
{ "id": 7, "name": "Anna Smith", "avatar": "https://cdn.example.com/avatar.jpg", "color": "#df532d", "type": "user" }
],
"commentInfo": [
{
"chatId": 2001,
"dialogId": "chat2001",
"messageId": 845,
"lastUserIds": [7],
"messageCount": 2,
"isUserSubscribed": true
},
{
"chatId": 2003,
"dialogId": "chat2003",
"messageId": 846,
"lastUserIds": [],
"messageCount": 1,
"isUserSubscribed": true
}
]
}
}
Error response example
422 — the posts belong to different channels:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "MESSAGES_IN_DIFFERENT_CHAT_ERROR",
"b24Code": "MESSAGES_IN_DIFFERENT_CHAT_ERROR"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionmessageIds is missing, empty or given more than once, has more than 100 items or an item that is not a positive integer, or another parameter is given. Checked before any call to Bitrix24 |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionBitrix24 returned a generic "not found" code or an error with the text "not found". The portal code is in error.b24Code |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 returned an error, the portal code is in error.b24Code. MESSAGE_NOT_FOUND — there is no message with this ID, MESSAGES_IN_DIFFERENT_CHAT_ERROR — the posts belong to different channels |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the im scope |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no Bitrix24 tokens configured |
The full list of common API errors — Errors.
Known specifics
The thread appears together with the post. A thread is created as soon as the post is sent to the channel, before the first comment.
A post without a thread is skipped without an error. A forwarded post does not appear in data.commentInfo. If all messageIds belong to a chat that is not a channel, data.commentInfo is empty.