Documentation

pull.application.push.add

Description

Method for sending push notification to a mobile device within Bitrix24 application framework.

Parameters

Parameter Example Required Description
USER_ID 1 or [1,2,3] Yes Push notification recipient user IDs.
TEXT 'Hello, world!' No Arbitrary text.
AVATAR 'https://files.johnsmith.com/images/avatar_smith.jpg' No Image link.

Examples

JavaScript

BX24.callMethod('pull.application.push.add', {
	'USER_ID': [1,2,3],
	'TEXT': 'Hello, world!',
	'AVATAR': 'https://files.shelenkov.com/images/avatar-ivanov.jpg',
}, function(result){
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

PHP

$result = restCommand('pull.application.push.add', [
	'USER_ID': [1,2,3],
	'TEXT': 'Hello, world!',
	'AVATAR': 'https://files.shelenkov.com/images/avatar-ivanov.jpg',
], $_REQUEST["auth"]);	

Response example

{
    "result": true
}

Example of error response

{
    "error": "WRONG_AUTH_TYPE",
    "error_description": "Send push notifications available only for application authorization."
}

Keys:

  • error - erro key
  • error_description - brief error description

Possible error codes

Code Description
TEXT_ERROR Message text not passed.
EMPTY_APP_NAME Error occurs when your application doesn't have a name.
ACCESS_ERROR Method can be used only by user with administrator rights.
WRONG_AUTH_TYPE Method can be used only within OAuth 2.0.

See Also



© «Bitrix24», 2001-2024