For AI agents: markdown of this page — /docs-content-en/chats/messages/comments.md documentation index — /llms.txt

Channel comments

A channel post may have a comment thread — a separate chat bound to the post. These calls read a summary of comment threads, mark all comments in a channel as read and enable or disable notifications about new comments on a post. The v2 messenger methods: im.v2.Chat.Message.CommentInfo.list, im.v2.Chat.Comment.readAll, im.v2.Chat.Comment.subscribe and im.v2.Chat.Comment.unsubscribe.

Comment summary for posts

GET /v1/chats/messages/comments

For each post with a comment thread, returns its chat, the number of messages in it, the latest commenters and whether you follow the thread.

Parameters

Parameter Type Required Default Description
messageIds (query) string yes — Comma-separated IDs of 1 to 100 posts from one channel: 845,846

Any other parameter, or messageIds given more than once, is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/messages/comments?messageIds=845,846" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
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

javascript
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

javascript
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
success boolean Always true on success
data.commentInfo array One item per post that has a comment thread
data.commentInfo[].messageId number Post ID
data.commentInfo[].chatId number ID of the comment chat
data.commentInfo[].dialogId string Dialog ID of the comment chat, chatN
data.commentInfo[].messageCount number Number of messages in the thread. A thread opens with a system message, so a thread without comments shows 1 here
data.commentInfo[].lastUserIds array IDs of the latest commenters
data.commentInfo[].isUserSubscribed boolean Whether you follow the post's comments
data.usersShort array Brief details of the commenters: id, name, avatar, color, type

Response example

JSON
{
  "success": true,
  "data": {
    "commentInfo": [
      {
        "chatId": 2001,
        "dialogId": "chat2001",
        "messageId": 845,
        "lastUserIds": [7],
        "messageCount": 3,
        "isUserSubscribed": true
      }
    ],
    "usersShort": [
      { "id": 7, "name": "Anna Smith", "avatar": "", "color": "#df532d", "type": "user" }
    ]
  }
}

Mark all channel comments as read

POST /v1/chats/:dialogId/comments/read-all

Marks all comments on all posts in the channel as read for you.

Parameters

Parameter Type Required Default Description
dialogId (path) string yes — Dialog ID of the channel, chatXXX

No body is needed. Query parameters and body fields are rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Comments marked as read:', data.result)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat2000/comments/read-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Comments marked as read:', data.result)

Follow post comments

POST /v1/chats/messages/:messageId/comments/subscription

Turns on notifications about new comments on the post.

Parameters

Parameter Type Required Default Description
messageId (path) number yes — ID of the channel post, a positive integer

No body is needed. Query parameters and body fields are rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Notifications on:', data.result)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Notifications on:', data.result)

Stop following post comments

DELETE /v1/chats/messages/:messageId/comments/subscription

Turns off notifications about new comments on the post.

Parameters

Parameter Type Required Default Description
messageId (path) number yes — ID of the channel post, a positive integer

No body is needed. Query parameters and body fields are rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X DELETE "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription', {
  method: 'DELETE',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
console.log('Notifications off:', data.result)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/comments/subscription', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Notifications off:', data.result)

Response

Marking all comments as read, following and unfollowing return the same response:

JSON
{
  "success": true,
  "data": { "result": true }
}

Error response example

422 — the message is not a channel post:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "WRONG_PARENT_CHAT",
    "b24Code": "WRONG_PARENT_CHAT"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS messageId is not a positive integer; for the summary — messageIds is missing, empty, has more than 100 items, has an item that is not a positive integer, is given more than once, or another parameter is given; for the other calls — any query parameter or body field. Checked before any call to Bitrix24
404 ENTITY_NOT_FOUND Bitrix24 returned "not found"; the portal code is in error.b24Code
422 BITRIX_ERROR Bitrix24 returned an error; the portal code is in error.b24Code. WRONG_MESSAGE_TYPE — the chat is not a channel; WRONG_PARENT_CHAT — the message is not a channel post; MESSAGES_IN_DIFFERENT_CHAT_ERROR — the posts belong to different channels
403 SCOPE_DENIED The API key does not have the im scope
403 WRITE_BLOCKED_READONLY_KEY The key is read-only: marking all comments as read, following and unfollowing change data — see access rights. The summary stays a read
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured
502 ME_ALIAS_RESOLUTION_FAILED Could not resolve the current user for dialogId = me

The full list of common API errors — Errors.

Known specifics

Following means notifications, not events. Following turns on notifications about new comments. It does not deliver comments in real time — for that, subscribe to events.

The thread appears together with the post. Bitrix24 opens a thread as soon as a post is sent to the channel, before the first comment. A forwarded post has no thread; for such a post, following and unfollowing create one — the Bitrix24 messenger does the same. So the call works on any channel post.

Unfollowing marks the thread as read. When you unfollow a post, Bitrix24 also marks its comments as read for you.

The summary covers posts with a thread only. A post without a thread, such as a forwarded one, does not appear in data.commentInfo. All messageIds must belong to the same channel.

See also