Connection Areas

Widget connection areas

Connecting widgets is essentially a connection of JS scripts on certain pages (interfaces) of amoCRM. You can do this not at all, but only on a certain list of screens.

The names of all areas are listed below:

Parameter Description
lcard, cucard, ccard, comcard cards of leads, buyers, contacts and companies
llist, culist, clist, tlist Lists of leads, customers, contacts and tasks
settings Widget installation and configuration page
advanced_settings Advanced widget settings page
card_sdk SDK card
(requires lcard, ccard, comcard to work in the cards of the relevant entities)
catalogs SDK list
digital_pipeline Digital pipeline
lead_sources Sources of leads
everywhere The widget will be initialized everywhere

Our system needs to provide information about where the widget is displayed and where it will use the right column. To do this, in the "locations" section of the manifest.json file, list the desired areas with 1 or 0 after the name as the right column usage parameter (by default, it is 1). Note that the "everywhere" area does not accept this parameter (it is always 0 for this region).

For example, this widget will be initialized on the settings page, in the digital pipeline, in the cards and the lists of contacts and leads, but the right column will only be used in the specified cards

  1. "locations":[
  2.     "lcard-1",
  3.     "llist-0",
  4.     "ccard-1",
  5.     "clist-0",
  6.     "comcard-0",
  7.     "card_sdk",
  8.     "settings",
  9.     "digital_pipeline",
  10.     "lead_sources",
  11.     "catalogs",
  12.     "advanced_settings"
  13.   ]

In addition, specifying true or false in the "init_once" block of the manifest.json file controls the ability to call the init () and bind_actions () functions each time a transition from a region to an area, or call them only once. For example, telephony widgets constantly hold the WebSocket connection and its breakage should not occur, so init_once should be set to true. If there is no context common for all pages, it's better to put it in false.

Note that the widget's JS code can be "hung" on certain events. There is a certain specificity in dealing with events in cards and in lists.

When JS is loaded in any interface, the callback function render (), and then init () and bind_actions () will work. When the widget is initialized in the ccard or lcard areas, the right widget column with the widget appears at once, and when working with the list, the right column and widget are added to the page by the selected event - the corresponding callback function in script.js is triggered. This function is called when the user selects the correct rows of the table using the checkbox, and then selects the widget in the context menu. A context menu appears when you use at least one checkbox.

In case you specify the locations in the locations of digital_pipeline, the logo_dp.png logo with a resolution of 174x109 is required in the widget.

Also, for the widget to work in a digital pipeline, you need a php-part of the widget with the endpoint of digital_pipeline.

If your widget has a lead_sources scope, then you can check which pipeline of the account it is bound to using the HTTP request or in the script.js of your widget:

  1. http://myaccount.amocrm.com/private/api/v2/json/widgets/list?filter[widget_code]=my_widget_code

To work with SDK lists, you need to specify a special scope of "catalogs", the id of the list with which the widget will work, and also implement a special callback loadCatalogElement.
More information about SDK directories.

To create your own page in the "Settings" section, you must specify the scope of advanced_settings, and add the advanced block to maniifest.json and implement a special callback advancedSettings.
Learn more about the widget's advanced customization page.