Documentation

pull.application.event.add

Description

Method for sending events to application's RT channel.

Parameters

Parameter Example Required Description
COMMAND 'test' Yes Event type, string.
PARAMS {JSON Object} No Arbitrary JSON array with data.
MODULE_ID 'application' No Indicate the option when sending commands from various application subsystems.
USER_ID 1 or [1,2,3] No When USER_ID is not indicated, the data will be sent to general channel. When user ID is indicated, data will be sent to private channel.
Administrator can send data simultaneously to several users and to the general channel, but user without admin rights - only to her/himself or to general channel.

Examples

JavaScript

BX24.callMethod('pull.application.event.add', {
	'COMMAND': 'test',
	'PARAMS': '{"param1":"value1"}',
}, function(result){
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

PHP

$result = restCommand('pull.application.event.add', [
	'COMMAND': 'test',
	'PARAMS': ['param1' => 'value1'],
], $_REQUEST["auth"]);

Response example

{
    "result": true
}

Response example when error occurs

{
    "error": "WRONG_AUTH_TYPE",
    "error_description": "Get access to application config available only for application authorization."
}

Keys:

  • error - error code
  • error_description - error brief description

Possible error codes

Code Description
COMMAND_ERROR MODULE_ID field format is incorrect. Latin characters in mixed case, numerical symbols, underscore, period and etc characters are permitted.
MODULE_ID_ERROR MODULE_ID field format is incorrect. Latin characters in lower case, numerical symbols, underscore, period are permitted.
USER_ID_ACCESS_ERROR Only user with administrator rights can indicate arbitrary users.
PARAMS_ERROR Incorrect JSON object passed.
WRONG_AUTH_TYPE Method can be used only within OAuth 2.0 or via webhooks.

See Also



User Comments

User comments are not part of official documentation. Use information provided by other users in the comments at your own risk.

The User Comments section is not to be used as a feature discussion board. Only registered users can post comments. Your comment will be visible once it has been approved by the moderator.
© «Bitrix Inc.», 2001-2021, «Bitrix Inc.», 2021