Chatbots 2.0: Quick Start
If you are developing integrations for Bitrix24 using AI tools (Codex, Claude Code, Cursor), connect to the MCP server so that the assistant can utilize the official REST documentation.
Scope:
imbotWho can execute methods: owner of the registered bot
A brief scenario for launching a chatbot on imbot.v2: creating a webhook, registering a bot, receiving events, sending messages, and working with files.
Before you begin, check the API Change Log for imbot.v2. It contains new features, fixes, and breaking changes, with entries listed from newest to oldest.
Creating an Incoming Webhook
To get started quickly, create an incoming webhook in the Bitrix24 interface:
- Go to
Developer resources -> Other -> Incoming Webhook. - In the permissions, select the scope
imbot. - Save and copy the webhook URL.
URL format:
https://{account}/rest/{user_id}/{webhook_token}/
Typical Use-case
1. Register the Bot
Use the method imbot.v2.Bot.register to create a bot and set its main properties.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.Bot.register' \
-H 'Content-Type: application/json' \
-d '{
"botToken": "my_secret_token_123",
"fields": {
"code": "support_bot",
"properties": {"name": "Support Bot", "workPosition": "AI Assistant"},
"eventMode": "fetch"
}
}'
2. Get Events (fetch mode)
Use imbot.v2.Event.get to retrieve the event queue for the registered bot.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.Event.get' \
-H 'Content-Type: application/json' \
-d '{
"botId": 456,
"botToken": "my_secret_token_123",
"limit": 50
}'
3. Respond in Chat
Use imbot.v2.Chat.Message.send to send a response in the dialogue.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.Chat.Message.send' \
-H 'Content-Type: application/json' \
-d '{
"botId": 456,
"botToken": "my_secret_token_123",
"dialogId": "chat5",
"fields": {"message": "Hello! How can I help you?"}
}'
4. Read Message by replyId (only supervisor/personal)
If a user replies to the bot's message, retrieve the original message using imbot.v2.Chat.Message.get.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.Chat.Message.get' \
-H 'Content-Type: application/json' \
-d '{
"botId": 456,
"botToken": "my_secret_token_123",
"messageId": 789
}'
5. Upload File to Chat
Use imbot.v2.File.upload to send a file in the chat on behalf of the bot.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.File.upload' \
-H 'Content-Type: application/json' \
-d '{
"botId": 456,
"botToken": "my_secret_token_123",
"dialogId": "chat5",
"fields": {"name": "report.txt", "content": "SGVsbG8gV29ybGQh", "message": "Here is the report"}
}'
6. Get Download Link for File
Use imbot.v2.File.download to obtain the URL for downloading the file.
curl -X POST 'https://example.bitrix24.com/rest/1/webhook_token/imbot.v2.File.download' \
-H 'Content-Type: application/json' \
-d '{
"botId": 456,
"botToken": "my_secret_token_123",
"dialogId": "chat5",
"fileId": 138
}'
Additional Messaging Features
When sending messages through imbot.v2.Chat.Message.send, the following features are available:
- Text Formatting (BB Codes): bold, italic, links, quotes, code, and other BB codes
- Attachments (Attach): structured blocks with images, tables, grids, and other elements
- Keyboards (Keyboard): interactive buttons below the message
API Revisions and Compatibility
Bitrix24 cloud and on-premise versions may have different API revisions. To find out which revision is installed on a specific account, use imbot.v2.Revision.get.
New features, fixes, and changes with loss of backward compatibility are compiled on the API Change Log for imbot.v2. If the integration is already working in production, this page should be checked first.
Learning Path
- API Change Log for imbot.v2
- imbot.v2.Bot.register
- imbot.v2.Event.get
- imbot.v2 Events
- imbot.v2.Chat.Message.send
- imbot.v2.Chat.Message.get and imbot.v2.Chat.Message.getContext
- imbot.v2.Command.register
- imbot.v2.File.upload and imbot.v2.File.download
- imbot.v2.Chat.add
Continue Learning
- API Change Log for imbot.v2
- Chatbots 2.0: Overview of Methods
- Register a bot imbot.v2.Bot.register
- Get Events from imbot.v2.Event.get
- Event Formats for imbot.v2
- Send Message imbot.v2.Chat.Message.send
- Objects and Fields of Chatbots 2.0
- Migration from imbot to imbot.v2