Views: 555 (Data available since 06.02.2017)

Attention! The restCommand function is used in all methods. This method is used to send data in Bitrix24 and is available in the EchoBot example as well as in this article. You can use your own function or BX24.callMethod, or bitrix24-php-sdk JavaScript methods.


Send personal notification

REST method: im.notify.personal.add

Method call:
$result = restCommand('im.notify.personal.add', Array(

   'USER_ID' => 1, // ID of the user who will receive notification (required)
   'MESSAGE' => 'Personal notification', // notification text (required)
   'MESSAGE_OUT' => 'Personal notification text for mail', // notification text for mail, if not specified - MESSAGE field is used
   'TAG' => 'TEST', // notification tag, unique within the system. When adding notification with existing tag other notifications will be deleted
   'SUB_TAG' => 'SUB|TEST', // additional tag, without duplication check 
   'ATTACH' => '' // attachment
  
), $_REQUEST["auth"]);
Required fields: USER_ID (ID of the user to will receive notification), MESSAGE (notification text).

Result: notification text ID or error.

Related links:

How to work with attachments

Possible errors:

Error codeError description
USER_ID_EMPTY Recipient ID not specified.
MESSAGE_EMPTY Message text not passed.
ATTACH_ERROR Complete attachment object not validated.
ATTACH_OVERSIZE Maximum permissible attachemnt size is exceeded (30 Kb).


Send system notification

REST method: im.notify.system.add

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

   'USER_ID' => 1, // ID of the user, who will receive notification (required)
   'MESSAGE' => 'System notification', // notification text (required)
   'MESSAGE_OUT' => 'System notification text for mail', // notification text for mail, if not specified - MESSAGE field is used
   'TAG' => 'TEST', // notification tag, unique within the system. When adding notification with exiting tag, other notifications will be deleted
   'SUB_TAG' => 'SUB|TEST', // additional tag, without duplication check
   'ATTACH' => Array() // attachment
  
), $_REQUEST["auth"]);
Required fields: USER_ID (ID of the user who will receive the notification), MESSAGE (notification text).

Result: notification ID or error.

Related links:

How to work with attachments

Possible errors:

Error codeError description
USER_ID_EMPTY Recipient ID not specified.
MESSAGE_EMPTY Message text not passed.
ATTACH_ERROR Complete attachment object not validated.
ATTACH_OVERSIZE Maximum permitted attachment size exceeded (30 kb).


Delete notification

REST method: im.notify.delete

Method call:
$result = restCommand('im.notify.delete', Array(

    'ID' => 13, // notification ID (one of three parameters: ID, TAG or SUB_TAG is required)
    'TAG' => 'TEST' // notification tag (one of three parameters: ID, TAG or SUB_TAG is required)
    'SUB_TAG' => 'SUB|TEST' // additional tag (one of three parameters: ID, TAG or SUB_TAG is required)

), $_REQUEST["auth"]);
Required fields: One of three parameter must be selected: ID (notification ID), TAG (notification tag) or SUB_TAG (additional tag).

Result: true or error.

Possible errors:

Error codeError description
PARAMS_ERROR Notification deletion error.



Chapter contents:


Courses developed by «Bitrix», Inc.