Event on Message Update ONIMBOTMESSAGEUPDATE

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: imbot

Who can subscribe: a user of the application that registered the chat bot

DEPRECATED

Development of this event has been halted. Please use ONIMBOTV2MESSAGEUPDATE.

The ONIMBOTMESSAGEUPDATE event is triggered when a message is updated in a chat with the chat bot. This event only works within the context of the chat bot application.

For bots with TYPE=B/H and OPENLINE=N, the EVENT_MESSAGE_UPDATE parameter is ignored in the imbot.register method. To trigger the event for such bots, bind the EVENT_MESSAGE_UPDATE handler using the imbot.update method.

Events will not be sent to the application until the installation is complete. Check the application installation

Event Triggering Rule

The event is triggered if the EVENT_MESSAGE_UPDATE handler is bound and the message complies with the bot type logic:

  • TYPE=B/H:
    • personal chat with the bot: the event triggers regardless of mentions,
    • group chat: triggers only when the bot is mentioned,
  • TYPE=S — the event triggers regardless of mentions,
  • TYPE=O — the event triggers in open line chats where the bot is involved.

Without EVENT_MESSAGE_UPDATE, the event will not trigger regardless of mentions.

What the Handler Receives

Data is transmitted as a POST request

{
            "event": "ONIMBOTMESSAGEUPDATE",
            "event_handler_id": "455",
            "data": {
                "BOT": {
                    "571": {
                        "access_token": "880aa0690000071b000008440000023bf0f107a4af72f200b757ece",
                        "expires": "1772096136",
                        "expires_in": "3600",
                        "scope": "imbot",
                        "domain": "some-domain.bitrix24.com",
                        "server_endpoint": "https://oauth.bitrix.info/rest/",
                        "status": "F",
                        "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                        "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                        "refresh_token": "7889c7690000071b000008440000023bf0f107ad212748fb2268",
                        "user_id": "571",
                        "client_id": "a7eff906dd1d950269258a599214f69e",
                        "application_token": "831c76b092f9f135d9b6b36c3a720757",
                        "AUTH": {
                            "access_token": "880aa0690000071b000008440000023bf0f107a4af72f200b757ece",
                            "expires": "1772096136",
                            "expires_in": "3600",
                            "scope": "imbot",
                            "domain": "some-domain.bitrix24.com",
                            "server_endpoint": "https://oauth.bitrix.info/rest/",
                            "status": "F",
                            "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                            "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                            "refresh_token": "7889c7690000071b000008440000023bf0f107ad212748fb2268",
                            "user_id": "571",
                            "client_id": "a7eff906dd1d950269258a599214f69e",
                            "application_token": "831c76b092f9f135d9b6b36c3a720757"
                        },
                        "BOT_ID": "571",
                        "BOT_CODE": "BOT"
                    }
                },
                "PARAMS": {
                    "ID": "84531",
                    "CHAT_ID": "1453",
                    "AUTHOR_ID": "27",
                    "MESSAGE": "How to add an observer to the task?",
                    "MESSAGE_TYPE": "P",
                    "CHAT_AUTHOR_ID": "571",
                    "CHAT_ENTITY_ID": "",
                    "CHAT_ENTITY_DATA_1": "",
                    "CHAT_ENTITY_DATA_2": "",
                    "CHAT_ENTITY_DATA_3": "",
                    "FROM_USER_ID": "27",
                    "TO_USER_ID": "571",
                    "CHAT_USER_COUNT": "2",
                    "PLATFORM_CONTEXT": "web",
                    "DIALOG_ID": "27",
                    "MESSAGE_ID": "84531",
                    "CHAT_TYPE": "P",
                    "LANGUAGE": "en"
                },
                "USER": {
                    "ID": "27",
                    "NAME": "Svetlana Ivanova",
                    "FIRST_NAME": "Svetlana",
                    "LAST_NAME": "Ivanova",
                    "WORK_POSITION": "",
                    "GENDER": "F",
                    "IS_BOT": "N",
                    "IS_CONNECTOR": "N",
                    "IS_NETWORK": "N",
                    "IS_EXTRANET": "N"
                }
            },
            "ts": "1772092536",
            "auth": {
                "access_token": "880aa06900071b00084400001b0007dff360d21523410a45b4f7c12",
                "expires": "1772096136",
                "expires_in": "3600",
                "scope": "imbot",
                "domain": "some-domain.bitrix24.com",
                "server_endpoint": "https://oauth.bitrix.info/rest/",
                "status": "F",
                "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                "user_id": "27",
                "refresh_token": "7889c769000071b000084400001b00007c0063d012b7284",
                "application_token": "831c76b092f9f135d9b6b36c3a720757"
            }
        }
        
{
            "event": "ONIMBOTMESSAGEUPDATE",
            "event_handler_id": "455",
            "data": {
                "BOT": {
                    "571": {
                        "access_token": "2c1da06900071b00084400023bf0f107464a9d34dc68a6b185f",
                        "expires": "1772100908",
                        "expires_in": "3600",
                        "scope": "imbot",
                        "domain": "some-domain.bitrix24.com",
                        "server_endpoint": "https://oauth.bitrix.info/rest/",
                        "status": "F",
                        "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                        "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                        "refresh_token": "1c9cc76900071b00084400023bf0f107bbc698c8eca4b3e89099f4",
                        "user_id": "571",
                        "client_id": "a7eff906dd1d950269258a599214f69e",
                        "application_token": "831c76b092f9f135d9b6b36c3a720757",
                        "AUTH": {
                            "access_token": "2c1da06900071b00084400023bf0f107464a9d34dc68a6b185f",
                            "expires": "1772100908",
                            "expires_in": "3600",
                            "scope": "imbot",
                            "domain": "some-domain.bitrix24.com",
                            "server_endpoint": "https://oauth.bitrix.info/rest/",
                            "status": "F",
                            "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                            "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                            "refresh_token": "1c9cc76900071b00084400023bf0f107bbc698c8eca4b3e89099f4",
                            "user_id": "571",
                            "client_id": "a7eff906dd1d950269258a599214f69e",
                            "application_token": "831c76b092f9f135d9b6b36c3a720757"
                        },
                        "BOT_ID": "571",
                        "BOT_CODE": "BOT"
                    }
                },
                "PARAMS": {
                    "ID": "84537",
                    "CHAT_ID": "1157",
                    "AUTHOR_ID": "27",
                    "MESSAGE": "create a task list",
                    "MESSAGE_TYPE": "C",
                    "CHAT_AUTHOR_ID": "27",
                    "CHAT_ENTITY_TYPE": "THREAD",
                    "CHAT_ENTITY_ID": "",
                    "CHAT_ENTITY_DATA_1": "",
                    "CHAT_ENTITY_DATA_2": "",
                    "CHAT_ENTITY_DATA_3": "",
                    "CHAT_USER_COUNT": "2",
                    "MENTIONED_LIST": {
                        "571": "571"
                    },
                    "PLATFORM_CONTEXT": "web",
                    "MESSAGE_ORIGINAL": "[USER=571]NewBot[/USER], create a task list",
                    "TO_USER_ID": "571",
                    "DIALOG_ID": "chat1157",
                    "MESSAGE_ID": "84537",
                    "CHAT_TYPE": "C",
                    "LANGUAGE": "en"
                }
            },
            "ts": "1772097308",
            "auth": {
                "access_token": "2c1da06900071b00084400001b00077e03d155e8",
                "expires": "1772100908",
                "expires_in": "3600",
                "scope": "imbot",
                "domain": "some-domain.bitrix24.com",
                "server_endpoint": "https://oauth.bitrix.info/rest/",
                "status": "F",
                "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                "member_id": "bac1cd5c8940947a75e0d71b1a84e348",
                "user_id": "27",
                "refresh_token": "1c9cc76900071b00084400001b00007b2dbee904c1",
                "application_token": "831c76b092f9f135d9b6b36c3a720757"
            }
        }
        

Parameter
type

Description

event
string

Event character code.

In this case — ONIMBOTMESSAGEUPDATE

event_handler_id
integer

Identifier of the event handler.

data
object

Object containing event data.

The structure is described below

ts
timestamp

Date and time the event was sent from the event queue

auth
object

Object with authorization parameters of the user on behalf of whom the event was triggered.

The structure is described below

Parameter data

Parameter
type

Description

BOT
object

Set of authorization parameters for the bots to which the event is addressed. The object key is the bot identifier BOT_ID.

The structure is described below

PARAMS
object

Parameters of the updated message.

The structure is described below

USER
object

Data of the message author. May be absent or empty.

The structure is described below

Parameter BOT

Parameter
type

Description

{BOT_ID}
object

Data object of a specific bot. The key corresponds to the bot identifier, for example 571.

The structure is described below

Element /

Parameter
type

Description

access_token
string

OAuth authorization token for the bot

expires
timestamp

Moment when the token expires

expires_in
integer

Token lifetime in seconds

scope
string

Scope within which the event occurred

domain
string

Bitrix24 address where the event occurred

server_endpoint
string

Address of the OAuth server for REST requests

status
string

Application status indicator on the account

client_endpoint
string

General path for REST API method calls for the account where the event occurred

member_id
string

Unique identifier of Bitrix24

refresh_token
string

OAuth token for extending bot authorization

user_id
integer

Identifier of the bot user

client_id
string

Application identifier issued upon registration

application_token
string

Application token

AUTH
object

Bot authorization parameters in auth format.

The structure is described below

BOT_ID
integer

Identifier of the bot

BOT_CODE
string

Character code of the bot

Parameter PARAMS

Parameter
type

Description

ID
integer

Identifier of the message

CHAT_ID
integer

Identifier of the chat

AUTHOR_ID
integer

Identifier of the message author

MESSAGE
string

Text of the message after the update.

In a group chat, the text is transmitted without BB-code mentions of the bot

MESSAGE_TYPE
string

Type of message

Possible values:

  • P — private, personal chat
  • C — group chat
  • O — open chat
  • L — open line
  • S — system/notify
  • N — channel
  • J — open channel
  • T — comment thread
  • A — copilot chat
  • B — collab
  • X — external chat

CHAT_AUTHOR_ID
integer

Identifier of the chat owner

CHAT_ENTITY_TYPE
string

Type of the object to which the chat is linked

CHAT_ENTITY_ID
string

Identifier of the object to which the chat is linked

CHAT_ENTITY_DATA_1
string

Additional data of the chat object — field 1

CHAT_ENTITY_DATA_2
string

Additional data of the chat object — field 2

CHAT_ENTITY_DATA_3
string

Additional data of the chat object — field 3

FROM_USER_ID
integer

Identifier of the message sender. This field is filled for personal chats

TO_USER_ID
integer

Identifier of the recipient.

In a personal chat, this is the identifier of the bot; in a group chat, it is the identifier of the user or bot to whom the message is addressed.

The value 0 means all participants in the chat

CHAT_USER_COUNT
integer

Number of participants in the chat

MENTIONED_LIST
object

Mentions of users in the message. This parameter depends on the chat type and is absent in personal chats.

The structure is described below

PLATFORM_CONTEXT
string

Platform from which the message was sent

MESSAGE_ORIGINAL
string

Original text of the message with BB-code mentions. This parameter depends on the chat type and is absent in personal chats

DIALOG_ID
string

Identifier of the dialog

MESSAGE_ID
integer

Identifier of the message. Duplicates the ID field

CHAT_TYPE
string

Type of chat.

Possible values:

  • P — private, personal chat
  • C — group chat
  • O — open chat
  • L — open line
  • S — system/notify
  • N — channel
  • J — open channel
  • T — comment thread
  • A — copilot chat
  • B — collab
  • X — external chat

LANGUAGE
string

Default language of Bitrix24

Parameter MENTIONED_LIST

Parameter
type

Description

{USER_ID}
integer

Identifier of the user or bot mentioned in the message

Parameter USER

Parameter
type

Description

ID
integer

Identifier of the user

NAME
string

Full name of the user

FIRST_NAME
string

First name of the user

LAST_NAME
string

Last name of the user

WORK_POSITION
string

Position of the user

GENDER
string

Gender of the user: M or F

IS_BOT
string

Indicator of a bot user: Y or N

IS_CONNECTOR
string

Indicator of a connector user: Y or N

IS_NETWORK
string

Indicator of an external network user: Y or N

IS_EXTRANET
string

Indicator of an extranet user: Y or N

Parameter auth

Required parameters are marked with *

Name
type

Description

access_token
string

Authorization token OAuth 2.0

expires_in
integer

Time in seconds until the token expires

scope*
string

Scope under which the event occurred

domain*
string

Address of Bitrix24 where the event occurred

server_endpoint*
string

Address of the Bitrix24 authorization server needed to refresh OAuth 2.0 tokens

status*
string

Status of the application that subscribed to this event:

client_endpoint*
string

Common path for REST API method calls for Bitrix24 where the event occurred

member_id*
string

Identifier of Bitrix24 where the event occurred

refresh_token
string

Token for extending authorization OAuth 2.0

application_token*
string

Token for secure event handling

Authorization tokens are not always passed to the event handler. If the hit that initiated the event could not be linked to a specific Bitrix24 user, the tokens are not passed. Always check the contents of the auth key in the code.

It is recommended to store tokens obtained earlier during the application installation. Use them when working with the application interface in the form of embeds, widgets, and so on.

Continue Learning