ADDING NOTIFICATIONS

To publish notifications, a public API is implemented, accessed through calling the corresponding methods of the global AMOCRM object. When you call the method, you need to transfer an object with a description of the notification.

Information Notice

The method is intended for calling a pop-up notification, which will be displayed to the user only in the interface and will not be replicated on other delivery channels.

Method name

show_message()

Parameters

Parameter Required Description
header Yes Post Title
text Yes Notification text
date No Date in timestamp format
icon No URL to arbitrary icon file. If not passed, then the default icon of robot is used

Example

  1. var message_params = {
  2.   header: "Warning",
  3.   text: "Connection established",
  4.   date: +19534084500,
  5.   icon: "https://www.example.com/images/telephone.png"
  6. };
  7. AMOCRM.notifications.show_message(message_params);

Result

Error Notification

The method displays an error notification in the interface of the account, and the message will not be transmitted via other delivery channels.

Method name

show_message_error()

Parameters

Parameter Required Description
header Yes Post Title
text Yes Notification text
date No Date in timestamp format
link No redirect URL when clicking on a notification

Example

  1. var error_params = {
  2.   header: "Warning",
  3.   text: "Connection to the server is lost"
  4. };
  5. AMOCRM.notifications.show_message_error(error_params);

Result

Incoming call notification

The method allows you to display a pop-up notification of a call or an error. If you use this message, it will be displayed only in the interface and will not be transmitted through other channels.

Method name

show_notification()

Parameters

Parameter Required Description
text Yes Array with a description of the message
text/header Yes Notification Header
text/text Yes Text message
date No Date in timestamp format
type Yes Type of pop-up notification. Can take values ​​call or type

Example

  1. var notification = {
  2.   text: {
  3.     header: "Outgoing call",
  4.     text: "Dialing the number +19872345678"
  5.   },
  6.   type: "call"
  7. };
  8. AMOCRM.notifications.show_notification(notification);

Result

Example

  1. var notification = {
  2.   text: {
  3.     header: "Error",
  4.     text: "Error working with the widget"
  5.   },
  6.   type: "error"
  7. };
  8. AMOCRM.notifications.show_notification(notification);

Result

Adding an error notification

The method allows you to add an error notification to the notification center. The message will be sent to all active channels in the user's account.

Method name

add_error()

Parameters

Parameter Required Description
header No Post Title
text Yes Notification text
date No Date in timestamp format
link No The link that will trigger the click on the notification

Example

  1. var error_params = {
  2.     header: "Error",
  3.     text: "Failed to set the task! Contact not found!",
  4.     date: +19534085310,
  5.     link: "/contacts/list/?term=4951234567"
  6. };
  7. AMOCRM.notifications.add_error(error_params);

Result

An email notification about the error.

Notification that has come to the mobile application.

Incoming call notification

The Notification Center API allows you to display an incoming call message. The notification will be transmitted over all active delivery channels.

Method name

add_call()

Parameters

Parameter Required Description
text Yes The text message that will be displayed in the notification.
date No Date in timestamp format
from No The line in which the initiator of the incoming call is specified. Phone number - if the contact is not found in your account. Contact name - if the call came from an existing contact in your account.
to No Manager name or extension number of the subscriber who received the incoming call.
element No An object describing the entity to which the transition will occur when clicking on the pop-up call notification.
element.id Yes Entity ID
element.type Yes Entity type: contact, lead or company

Parameter

  1. var call_params = {
  2.   text: "Call from +1 (415) 523-7743",
  3.   date: +19534084500,
  4.   from: "Jeremy Watts",
  5.   to: "Jason Nash",
  6.   element: { id: 18221265, type: "contact" },
  7.   duration: 250,
  8.   link: 'https://example.com/dialog.mp3'
  9. };
  10. AMOCRM.notifications.add_call(call_params);

Result

Notification of the call in the notification center and in the mobile application.