Views: 2113
Last Modified: 23.03.2022

Sending system notification

Revision Get current information about current API revision (platform version) – im.revision.get : 18

Attention: restCommand function is used here for illustration purposes only. It is taken from the EchoBot example. You can send a REST command with your own function, or use the BX24.callMethod or bitrix24-php-sdk methods.

Parameters

Parameter Example Required Description Revision
USER_ID 1 Yes User ID, notification recipient 18
MESSAGE System notification Yes Notification text 18
MESSAGE_OUT System notification text for email No Notification text for email. When not specified is not set, uses the field MESSAGE 18
TAG TEST No Notification tag, unique within the system. Deletes other notifications when adding the notification with existing tag. 18
SUB_TAG SUB|TEST No Additional tag, without duplicate check 18
ATTACH Array() No Attachment 18

Related links

How to handle attachments


Called method and response

PHP

$result = restCommand('im.notify.system.add', Array(

   'USER_ID' => 1,
   'MESSAGE' => 'System notification',
   'MESSAGE_OUT' => 'System notification text for email',
   'TAG' => 'TEST',
   'SUB_TAG' => 'SUB|TEST',
   'ATTACH' => Array()
  
), $_REQUEST["auth"]);

Response example

{
	"result": 123
}
Result: notification ID or error.


>

Response example on error

{
    "error": "USER_ID_EMPTY",
    "error_description": "Recipient is not specified"
}

Key description:

  • error – error code
  • error_description – error brief description

Possible error codes

Code Description
USER_ID_EMPTY Recipient ID is not specified
MESSAGE_EMPTY Message text is empty
ATTACH_ERROR Attachment object validation error
ATTACH_OVERSIZE Maximum allowed attachment size exceeded (30 Kb)



Courses developed by Bitrix24