Event on New Entries in the Offline Event Queue onOfflineEvent
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
Scope:
basicWho can subscribe: any user
The ONOFFLINEEVENT event is triggered when new entries appear in the offline event queue.
The event replaces polling the queue on a timer: the application receives a signal and retrieves the accumulated entries using the event.offline.get or event.offline.list methods.
Subscribe to ONOFFLINEEVENT only as a regular event — with the handler URL in the handler parameter of the event.bind method. Subscribing with event_type = offline returns the ERROR_ARGUMENT error with the text Offline event cannot be registered for this event: the queue notification itself is not placed into the queue.
Any user can subscribe, but only from an application: event.bind works with OAuth 2.0 authorization only and rejects a webhook call. Entries can be retrieved from the queue using the event.offline.* methods only by an administrator and, again, only in the application context. Read more in the article Offline Events.
Events will not be sent to the application until the installation is complete. Check the application installation
What the Handler Receives
Data is transmitted as a POST request
{
"event": "ONOFFLINEEVENT",
"event_handler_id": "185",
"data": [],
"ts": "1466439714",
"auth": {
"access_token": "s6p6eclrvim6da22ft9ch94ekreb52lv",
"expires_in": "3600",
"scope": "crm,task",
"domain": "some-domain.bitrix24.com",
"server_endpoint": "https://oauth.bitrix.info/rest/",
"status": "F",
"client_endpoint": "https://some-domain.bitrix24.com/rest/",
"member_id": "a223c6b3710f85df22e9377d6c4f7553",
"refresh_token": "4s386p3q0tr8dy89xvmt96234v3dljg8",
"application_token": "51856fefc120afa4b628cc82d3935cce"
}
}
Request Parameters
Required parameters are marked with *
|
Name |
Description |
|
event* |
Symbolic event code — |
|
event_handler_id* |
Identifier of the event handler |
|
data* |
Arrives empty. More details below |
|
ts* |
Date and time the notification was sent from the common event queue |
|
auth* |
Object containing authorization parameters and data about the Bitrix24 account where the event occurred. The The structure is described below |
Parameter data
The event does not transmit data about specific changes but only reports that new entries have appeared in the queue. It carries no payload, so data arrives empty — do not build the handler around parsing this parameter.
To retrieve the events themselves, call event.offline.get or event.offline.list. The structure of a queue entry is described on the pages of these methods.
Parameter auth
Required parameters are marked with *
|
Name |
Description |
|
access_token |
Authorization token OAuth 2.0 |
|
expires_in |
Time in seconds until the token expires |
|
scope* |
Scope under which the event occurred |
|
domain* |
Address of Bitrix24 where the event occurred |
|
server_endpoint* |
Address of the Bitrix24 authorization server needed to refresh OAuth 2.0 tokens |
|
status* |
Status of the application that subscribed to this event:
|
|
client_endpoint* |
Common path for REST API method calls for Bitrix24 where the event occurred |
|
member_id* |
Identifier of Bitrix24 where the event occurred |
|
refresh_token |
Token for extending authorization OAuth 2.0 |
|
application_token* |
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.
Notification Frequency
Bitrix24 does not send a separate notification for every queue entry. The minimum interval between notifications is set by the minTimeout parameter in the options object when subscribing with the event.bind method.
This is the only options parameter that ONOFFLINEEVENT supports.
|
Name |
Description |
|
minTimeout |
Minimum interval between notifications, in seconds. Defaults to 1.
Greater than |
Body of the event.bind request for a subscription with a 60-second interval:
{
"event": "ONOFFLINEEVENT",
"handler": "https://example.com/handler.php",
"options": {
"minTimeout": 60
}
}
Continue Exploring
- Events: Overview of Methods and Events
- Register a New Event Handler event.bind
- Retrieve a List of Registered Event Handlers event.get
- Unregister Event Handler event.unbind
- Offline Events
- Retrieve a List of Offline Events With Cleanup event.offline.get
- Get a List of Offline Events event.offline.list
- Clear Offline Event Queue event.offline.clear
- Register Offline Event Queue Processing Errors event.offline.error
- Security in Handlers