Copied +55 (21) 960104492
Log In Free trial
Select region

Embedding messengers in the developer's own system

СhatApp Dialog has 2 options for integration into the industry system interface:

1. Simplified. Integration via URL

Set a link to a dialogue within the industry system, the chat with the client will open in a separate window or tab.

Dialog link example (with chat ID): https://dialogs.pro/?crm[dialogIds][0]=79999999999@c.us&api[license_id]=30310&api[messenger_type]=grWhatsApp

Link parameters:

  • [dialogIds][0]=79999999999@c.us - chat ID;
  • &api[license_id]=15006 - channel number (license);
  • &api[messenger_type] - messenger.

Dialog link example (with customer phone number): https://dialogs.pro/?crm[phones][0]=79999999999&api[license_id]=30310&api[messenger_type]=grWhatsApp

Link parameters:

  • [phones][0]=79999999999 - customer phone number;
  • &api[license_id]=15006 - channel number (license);
  • &api[messenger_type] - messenger.

When opened, ChatApp Dialog will require a username and password once upon login.

If you set the &api[access_token] parameter in the link, you can enter ChatApp Dialog without authorization.

Inside each chat there is a button to copy the link to the dialog, it is useful for sharing between employees:

2. Embedding ChatApp Dialog via iFrame (into the interface of the developer system)

Any software system can integrate ChatApp Dialog into its interface via iFrame.

This integration option differs from integration via URL link only in that in the current version the link is inserted into the iFrame.

For more comfortable use, you can generate a link from an array of fields.

$fields = [
    'api' => [
        'access_token' => '$2y$10$3QNdSGJJarGvzMX277775777777WaI4QRW5Fw.NCWkbNONufjlEI.m',
        'license_id' => 15006,
        'messenger_type' => 'grWhatsApp',
        'crm_domain' => 'chatapp-dev46.bitrix24.ru',
        'employee_ext_code' => '123',
    ],
    'crm' => [
        'phones' => [
            '79954545454',
            '79985554544',
            '79985554513',
        ],
        'dialogIds' => [
            '79954545454@c.us'
        ]
    ],
];

Next, you need to convert the field array to a string to be passed to the iframe as GET parameters:

$query = http_build_query($fields);
Код подключения iframe:
<iframe
       id="webchat"
       src="https://dialogs.pro/?<?=$query?>"
       sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts allow-top-navigation allow-top-navigation-by-user-activation"
       allow="camera https://dialogs.pro/; microphone https://dialogs.pro/; clipboard-read https://dialogs.pro/; clipboard-write https://dialogs.pro/"
       width="100%"
       height="99%"
       style="border: 0;" >
</iframe>

Description of fields

api[access_token]Access token, see Authorization method.
api[license_id]Channel (license) number. Used to filter the list of licenses.
api[messenger_type]Messenger. Used to filter the list of messengers.
api[crm_domain]External system domain. Required for authorization under a specific employee.
api[employee_ext_code]Employee ID in the external system. Required for authorization under a specific employee.
crm[phones]Phone array. Used to filter dialogs.
crm[dialogIds]Array of chat IDs. Used to filter dialogs.

All fields are optional.

Note:
ChatApp Dialog, using the API token (access_token) passed from CRM, gets its new independent pair of tokens through a special method. Therefore, it will not break the CRM API token in any way. Moreover, the ChatApp Dialog itself manages the freshness of its token and refreshes it if necessary.
Important: pass a live access_token to ChatApp Dialog at the time of opening the frame.

An example of possible integration into a third-party system:

Leave a request for integrator services