Documentation

Events

REST interface allows setting up your own handlers for server events.

Handler is a URL that is called after user performs requested action at the Bitrix24 account with installed application. Because queries are sent from Bitrix24 servers, any URL will must be available for external GET/POST.

Handler receives the input data as follows:

Query field Description
event Triggered event name
data Array with event data. Depends in event.
auth Sets of authorization data.

The handler can perform the following actions:

  • use the retrieved auth data for executing queries to REST API.
  • be assigned only to user having administrative access permissions for account.

Note.When event handler requires a query to REST API for handling data, it's strongly recommended to use the auth data, saved in the application, instead of getting access_token, because it may be unavailable.

You need to indicate the user for event handler authorization. By default, event handler is issued with authorization for the user who's actions had triggered the events.

Event handler won't be called immediately but after some time depending on the load, after triggering the event.

You can retrieve the list of available events using the REST method events.

Use the REST method event.bind or JS library function BX24.callBind to assign an event handler. You can get registered event handlers via REST method events.get

Removing a registered event handler is performed via the REST method event.unbind or using JS library function BX24.callUnbind.

You must request a corresponding access permission to access each event when registering an app version.

Application can set an arbitrary number of handlers for a single event, but all handlers must be assigned with authorization for different users. Additionally, event handler call can depend on user access, which authorization will be issued to the handler.

Event names are case insensitive.

Attention! Registered default handlers are saved during app version upgrades. If required, they can be deleted by the installation handler for a new app version.

Example

App installation event

array(
  'event' => 'ONAPPINSTALL',
  'data' => array(
    'VERSION' => '1',
    'LANGUAGE_ID' => 'en',
  ),
  'ts' => '1466439714',
  'auth' => array(
    'access_token' => 's6p6eclrvim6da22ft9ch94ekreb52lv',
    'expires_in' => '3600',
    'scope' => 'entity,im',
    'domain' => 'portal.bitrix24.com',
    'server_endpoint' => 'https://oauth.bitrix.info/rest/',
    'status' => 'F',
    'client_endpoint' => 'https://portal.bitrix24.com/rest/',
    'member_id' => 'a223c6b3710f85df22e9377d6c4f7553',
    'refresh_token' => '4s386p3q0tr8dy89xvmt96234v3dljg8',
    'application_token' => '51856fefc120afa4b628cc82d3935cce',
  ),
)

All REST events

Event Call Webhook support
App events
OnAppInstall App installation
OnAppUpdate App update
OnAppUninstall App uninstallation
OnAppPayment App payment
OnAppMethodConfirm when getting account admin permission for methods that require confirmation
OnAppTest
OnSubscriptionRenew Updates user app subscription.
Bot platform events
OnImBotMessageAdd Message received by chatbot.
OnImBotMessageUpdate Message updated by chatbot.
OnImBotMessageDelete Message deleted by chatbot.
OnImBotJoinChat Chatbot receives message (or a private message) on being included into a chat.
OnImBotDelete Event for deleting a chatbot.
OnImCommandAdd Message for receiving a command by chatbot.
CRM events
Invoices
onCrmInvoiceAddwhen creating an invoice Yes
onCrmInvoiceDelete when deleting an invoice Yes
onCrmInvoiceSetStatus when updating invoice status Yes
onCrmInvoiceUpdate when updating an invoice Yes
onCrmInvoiceUserFieldAddwhen adding an invoice user field Yes
onCrmInvoiceUserFieldUpdate when editing an invoice user field Yes
onCrmInvoiceUserFieldDelete when deleting an invoice user field Yes
onCrmInvoiceUserFieldSetEnumValueswhen editing set of values for list user field Yes
onCrmInvoiceRecurringAddwhen creating new recurring invoice Yes
onCrmInvoiceRecurringUpdatewhen editing a recurring invoice Yes
onCrmInvoiceRecurringDeletewhen deleting a recurring invoice Yes
onCrmInvoiceRecurringExposewhen issuing new invoice from a recurring invoice Yes
Products
onCrmProductAddwhen creating a product Yes
onCrmProductUpdate when updating a product Yes
onCrmProductDelete when deleting a product Yes
onCrmProductPropertyAddwhen creating a product property Yes
onCrmProductPropertyUpdate when updating a product property Yes
onCrmProductPropertyDelete when deleting a product property Yes
onCrmProductSectionAdd after adding a product section Yes
onCrmProductSectionUpdate after editing product section Yes
onCrmProductSectionDelete after deleting a product section Yes
Leads
onCrmLeadAddwhen creating a lead Yes
onCrmLeadUpdate when updating a lead Yes
onCrmLeadDelete when deleting a lead Yes
onCrmLeadUserFieldAddwhen adding a lead user field Yes
onCrmLeadUserFieldUpdate when editing a lead user field Yes
onCrmLeadUserFieldDelete when deleting a lead user field Yes
onCrmLeadUserFieldSetEnumValueswhen editing a set of values for list user field Yes
Deals
onCrmDealAddwhen creating a deal Yes
onCrmDealUpdate when updating a deal Yes
onCrmDealDelete when deleting a deal Yes
onCrmDealUserFieldAddwhen adding a deal user field Yes
onCrmDealUserFieldUpdate when editing a deal user field Yes
onCrmDealUserFieldDelete when deleting a deal user field Yes
onCrmDealUserFieldSetEnumValueswhen editing set of values for user list field in a deal Yes
onCrmDealRecurringAddwhen creating a new recurring deal Yes
onCrmDealRecurringUpdatewhen updating a recurring deal Yes
onCrmDealRecurringDeletewhen deleting a recurring deal Yes
onCrmDealRecurringExposewhen creating a a new deal from recurring deal Yes
Companies
onCrmCompanyAddwhen creating a company Yes
onCrmCompanyUpdate when updating a company Yes
onCrmCompanyDelete when deleting a company Yes
onCrmCompanyUserFieldAddwhen adding a company user field Yes
onCrmCompanyUserFieldUpdate when editing a company user field Yes
onCrmCompanyUserFieldDelete when deleting a company user field Yes
onCrmCompanyUserFieldSetEnumValueswhen updating a set of values for company list user field Yes
Contacts
onCrmContactAddwhen creating a contact Yes
onCrmContactUpdate when updating a contact Yes
onCrmContactDelete when deleting a contact Yes
onCrmContactUserFieldAddwhen adding a user field Yes
onCrmContactUserFieldUpdate when updating a contact user field Yes
onCrmContactUserFieldDelete when deleting a contact user field Yes
onCrmContactUserFieldSetEnumValueswhen updating a set of values for contact list user field Yes
Currencies
onCrmCurrencyAddafter creating a currency Yes
onCrmCurrencyUpdate after updating a currency Yes
onCrmCurrencyDelete after deleting a currency Yes
Activities
onCrmActivityAddwhen creating an activity Yes
onCrmActivityUpdate when updating an activity Yes
onCrmActivityDelete when deleting an activity Yes
Quotes
onCrmQuoteAddwhen creating a quoteYes
onCrmQuoteUpdate when updating a quote Yes
onCrmQuoteDelete when deleting a quote Yes
onCrmQuoteUserFieldAdd when adding a quote user field Yes
onCrmQuoteUserFieldDelete when deleting a quote user fieldYes
onCrmQuoteUserFieldUpdate when updating a quote user fieldYes
onCrmQuoteUserFieldSetEnumValues when editing set of values for quote list user fieldYes
Requisites
onCrmRequisiteAdd when adding a requisite Yes
onCrmRequisiteUpdate when updating a requisite Yes
onCrmRequisiteDelete when deleting a requisite Yes
onCrmRequisiteUserFieldAddwhen adding a requisite user field Yes
onCrmRequisiteUserFieldUpdate when updating a requisite user field Yes
onCrmRequisiteUserFieldDelete when deleting a requisite user field Yes
onCrmRequisiteUserFieldSetEnumValueswhen updating set of values for requisite list user field Yes
onCrmBankDetailAdd when adding a bank detail Yes
onCrmBankDetailUpdate when updating a bank detail Yes
onCrmBankDetailDelete when deleting a bank detail Yes
onCrmAddressRegister when adding an address Yes
onCrmAddressUnregister when deleting an address Yes
Measurement units
onCrmMeasureAdd when adding a unit of measurement Yes
onCrmMeasureUpdate when updating a unit of measurement Yes
onCrmMeasureDelete when deleting a unit of measurement Yes
Timeline
onCrmTimelineCommentAddwhen adding new comment in timeline Yes
onCrmTimelineCommentUpdatewhen updating new comment in timeline Yes
onCrmTimelineCommentDeletewhen deleting new comment in timeline Yes
Telephony events
OnVoximplantCallInit when initializing a call (on receiving or starting an outbound call).
OnVoximplantCallStart when starting a conversation (operator response on inbound call and call recipient response on outbound).
OnVoximplantCallEnd when finishing a conversation (history entry).
OnExternalCallStart called when user clicks on phone number in CRM objects for executing an outbound call.Yes
OnExternalCallBackStart when completing CRM form for callback. Yes
Task events
OnTaskAdd when adding a task. Yes
OnTaskUpdate when updating a task.Yes
OnTaskDelete when deleting a task. Yes
OnTaskCommentAdd when adding comment to task. Yes
OnTaskCommentUpdate when editing a task comment. Yes
OnTaskCommentDelete when deleting comment to task Yes
Feed events
ONLIVEFEEDPOSTADD Proxy for PHP event OnAfterSocNetLogAdd. Yes
ONLIVEFEEDPOSTUPDATE Proxy for PHP event OnAfterSocNetLogUpdate. Yes
ONLIVEFEEDPOSTDELETE Proxy for PHP event OnSocNetLogDelete. Yes
Workgroup events
ONSONETGROUPADD After adding a new workgroup. Proxy for the event OnSocNetGroupAdd. Yes
ONSONETGROUPUPDATE After updating a workgroup. Proxy for the event onSocnetGroupUpdate Yes
ONSONETGROUPDELETE When deleting a workgroup. Proxy for the event OnSocNetGroupDelete Yes
ONSONETGROUPSUBJECTADD After creating workgroup topic. Proxy for the event OnSocNetGroupSubjectAdd. Yes
ONSONETGROUPSUBJECTUPDATE After updating workgroup topic. Proxy for the event OnSocNetGroupSubjectUpdate Yes
ONSONETGROUPSUBJECTDELETE Before deleting workgroup topic. Proxy for the event OnSocNetGroupSubjectDelete Yes
Online store events
OnSaleOrderSaved On saving an order, when the order and all associated entities are already saved. Yes
OnSaleBeforeOrderDelete Called before deleting an order. Yes
On where &entity>:

- PropertyValue;

- Payment;

- Shipment;

- Order.
EntitySaved
When directly after saving an order entity. Yes
On where &entity>:

- PropertyValue;

- Payment;

- Shipment;

- Order.
Deleted
When directly deleting an entity from database. Yes
User events
OnUserAdd When adding user to Bitrix24 Yes
External messenger connector
OnImConnectorLineDelete Deletes an Open Channel.
OnImConnectorMessageAdd New message from Open Channel.
OnImConnectorMessageUpdate Open Channel message updated.
OnImConnectorMessageDelete Open Channel message deleted.
OnImConnectorStatusDelete Deletes specific connection for an Open Channel.
Calendar events
OnCalendarEntryAdd When adding an event. Yes
OnCalendarEntryUpdate When editing an event. Yes
OnCalendarEntryDelete When deleting an event.Yes
OnCalendarSectionAdd When adding a calendar section CALENDAR_SECTION_ID . Also called when adding a resource.Yes
OnCalendarSectionUpdate When editing a section/resource.Yes
OnCalendarSectionDelete When deleting a section/resource.Yes
Commercial catalog events
CATALOG.MEASURE.ON.ADD When adding a unit of measurement.
CATALOG.MEASURE.ON.DELETE When deleting a unit of measurement.
CATALOG.MEASURE.ON.UPDATE When updating a unit of measurement.
CATALOG.PRICE.ON.ADD When adding a price.
CATALOG.PRICE.ON.DELETE When deleting a price.
CATALOG.PRICE.ON.UPDATE When updating a price.
CATALOG.PRICE.TYPE.ON.ADD When adding a price type.
CATALOG.PRICE.TYPE.ON.DELETE When deleting a price type.
CATALOG.PRICE.TYPE.ON.UPDATE When updating a price type.
CATALOG.PRODUCT.ON.ADD When adding a product.
CATALOG.PRODUCT.ON.DELETE When deleting a product.
CATALOG.PRODUCT.ON.UPDATE When updating a product.
CATALOG.ROUNDING.ON.ADD When adding a price rounding rule.
CATALOG.ROUNDING.ON.DELETE When deleting a price rounding rule.
CATALOG.ROUNDING.ON.UPDATE When updating a price rounding rule.
CATALOG.STORE.ON.ADD When adding a warehouse.
CATALOG.STORE.ON.DELETE When deleting a warehouse.
CATALOG.STORE.ON.UPDATE When updating a warehouse.


© «Bitrix24», 2001-2024