Event onUserAdd
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:
user,user_brief, oruser_basicWho can subscribe: any user
The ONUSERADD event is triggered when a user is added to Bitrix24. The event occurs not after the invitation, but after the user logs into Bitrix24 and completes the registration. The event is not sent for external user types, such as email users and bots.
You can subscribe to the event through an outbound webhook or from an application with the event.bind method. OAuth 2.0 tokens are not passed to an outbound webhook.
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": "ONUSERADD",
"event_handler_id": "16",
"data": {
"ID": "123",
"ACTIVE": "1",
"EMAIL": "user@example.com",
"NAME": "Klaus",
"LAST_NAME": "Weber",
"PERSONAL_GENDER": "M",
"PERSONAL_BIRTHDAY": "1990-01-01T00:00:00+01:00",
"UF_DEPARTMENT": ["1", "2"],
"DATE_REGISTER": "2024-04-05T00:00:00+02:00",
"WORK_POSITION": "Developer",
"UF_EMPLOYMENT_DATE": "2024-04-05T00:00:00+02:00"
},
"ts": "1466439714",
"auth": {
"access_token": "s6p6eclrvim6da22ft9ch94ekreb52lv",
"expires_in": "3600",
"scope": "user",
"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",
"application_token": "51856fefc120afa4b628cc82d3935cce"
}
}
Request Parameters
Required parameters are marked with *
|
Name |
Description |
|
event* |
Event character code — |
|
event_handler_id |
Event handler ID |
|
data* |
Data of the added user. The structure is described below |
|
ts* |
Date and time of the event sent from the queue |
|
auth* |
Object containing authorization parameters and information about the account where the event occurred. The structure is described below |
Parameter data
|
Name |
Description |
|
ID* |
User identifier |
|
ACTIVE* |
Whether the user is active. Possible values:
The event is triggered on the user's first login, so in practice |
|
EMAIL |
User's email |
|
NAME |
User's first name |
|
LAST_NAME |
User's last name |
|
PERSONAL_GENDER |
Gender: |
|
PERSONAL_BIRTHDAY |
Date of birth in ISO 8601 format, for example |
|
UF_DEPARTMENT |
Array of department |
|
DATE_REGISTER* |
Registration date in ISO 8601 format |
|
WORK_POSITION |
Position of the user |
|
UF_EMPLOYMENT_DATE |
Employment date in ISO 8601 format |
The table lists the main fields. The set of fields depends on the application permissions:
- with the
userscope, standard user fields are passed, custom fieldsUF_USR_*are not passed - with
user_basicoruser_brief, a reduced set of fields is passed, and together withuser.userfield, custom fieldsUF_USR_*as well
Fields the application has no access to and fields without a value are not passed. For field descriptions, see the article Get user fields user.fields.
Parameter auth
|
Name |
Description |
|
access_token |
Token for accessing the API |
|
expires_in |
Time in seconds until the token expires |
|
scope |
Codes of the permissions granted to the application, separated by commas |
|
domain* |
Address of Bitrix24 where the event occurred |
|
server_endpoint* |
Authorization server address for token renewal |
|
status |
Status of the application subscribed to this event:
|
|
client_endpoint* |
Common path for API method calls for Bitrix24 where the event occurred |
|
member_id* |
Unique identifier of the account |
|
application_token* |
Application token. Compare it with the token retained during the application installation or with the token from the outbound webhook settings to make sure the request came from Bitrix24. For more details, see the article Security in Handlers |
If the event could be linked to a user, auth contains access_token, expires_in, scope, and status, more details.
Continue Learning
- Events: Overview of Methods and Events
- Register a New Event Handler event.bind
- Overview of Events When Working with the Application
- Get a list of users by filter user.get
- Get user fields user.fields
- Event After Successful Application Installation onAppInstall
- Event on Application Payment onAppPayment
- Event on the Administrator's Decision on a Request for a Method Requiring Confirmation onAppMethodConfirm
- Event on Application Uninstallation: onAppUninstall