لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/chats/commands.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Bot commands in a chat

GET /v1/chats/:dialogId/commands

Returns the bot commands the current user can call in a chat, together with short cards of those bots.

Parameters

Parameter Type Required Description
ParameterdialogId (path) Typestring Requiredyes DescriptionDialog identifier: chatXXX for a group chat, a user ID for the personal dialog with that user, or me for the personal dialog with yourself. chatXXX is the data.items[].id field of recent dialogs, a user ID comes from GET /v1/users

The operation takes no query parameters. Any query parameter is refused with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl -X GET "https://vibecode.bitrix24.com/v1/chats/chat42/commands" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl -X GET "https://vibecode.bitrix24.com/v1/chats/chat42/commands" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/commands', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
})
const result = await response.json()

JavaScript — OAuth application

javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/commands', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
})
const result = await response.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.commands Typearray DescriptionCommands available in the chat
Fielddata.commands[].id Typenumber DescriptionCommand ID
Fielddata.commands[].botId Typenumber DescriptionID of the bot that owns the command. The bot card is the data.users element with the same id
Fielddata.commands[].command Typestring DescriptionCommand text, starts with /, for example /echo
Fielddata.commands[].category Typestring DescriptionName of the command group in the command list
Fielddata.commands[].common Typestring DescriptionY — the command is available in all chats, N — only in the personal dialog with the bot and in chats with the bot
Fielddata.commands[].context Typestring DescriptionCommand context
Fielddata.commands[].title Typestring DescriptionCommand description
Fielddata.commands[].params Typestring DescriptionHint for the command parameters
Fielddata.commands[].extranet Typestring DescriptionY — the command is available to extranet users, N — it is not
Fielddata.users Typearray DescriptionCards of the bots that own the commands
Fielddata.users[].id Typenumber DescriptionBot ID
Fielddata.users[].name Typestring DescriptionBot name
Fielddata.users[].avatar Typestring DescriptionAvatar URL. An empty string if no avatar is set
Fielddata.users[].color Typestring DescriptionBot color in #RRGGBB format
Fielddata.users[].type Typestring DescriptionUser type — bot

Response example

JSON
{
  "success": true,
  "data": {
    "commands": [
      {
        "id": 73,
        "botId": 1163,
        "command": "/giphy",
        "category": "Giphy",
        "common": "Y",
        "context": "",
        "title": "Post an image that matches the given topic",
        "params": "text",
        "extranet": "Y"
      },
      {
        "id": 103,
        "botId": 1291,
        "command": "/echo",
        "category": "MyBot",
        "common": "Y",
        "context": "",
        "title": "Echo",
        "params": "text",
        "extranet": "N"
      }
    ],
    "users": [
      {
        "id": 1163,
        "name": "Giphy",
        "avatar": "https://example.bitrix24.com/upload/giphy.png",
        "color": "#1eb4aa",
        "type": "bot"
      },
      {
        "id": 1291,
        "name": "MyBot",
        "avatar": "",
        "color": "#df532d",
        "type": "bot"
      }
    ]
  }
}

Error response example

422 — there is no chat with this dialogId:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "CHAT_NOT_FOUND",
    "hint": "dialogId must be a userId (number as string) for DMs or \"chat{N}\" for group chats. Examples: \"1\" for user 1, \"chat123\" for group chat 123. Create a group chat first via POST /v1/bots/:botId/chats if needed.",
    "b24Code": "CHAT_NOT_FOUND"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptiondialogId is neither a positive user ID, chatXXX, nor me, or a query parameter was passed
HTTP401 CodeMISSING_API_KEY DescriptionX-Api-Key was not passed
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured Bitrix24 tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is read-only, and either the request was not made with an employee's personal key or dialogId does not point to an existing dialog
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionBitrix24 refused access to the chat
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 did not find the object. The Bitrix24 code is in error.b24Code
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 returned an error, the Bitrix24 code is in error.b24Code. If the chat does not exist, the code is CHAT_NOT_FOUND
HTTP429 CodeRATE_LIMITED DescriptionThe Bitrix24 request limit was exceeded. The retry delay is in the Retry-After header
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionThe user could not be resolved when the me alias is used
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unavailable or returned a response that could not be read
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond within the time limit. The retry delay is in the Retry-After header

Full list of common API errors — Errors.

Known specifics

  • The list contains only commands of bots that are available to the current user in this dialog. Active chat membership is required.
  • For a read-only key, an existing dialog is chatXXX or a user ID from that employee's recent dialogs.

See also