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.

See Also



© «Bitrix24», 2001-2024