Embedding messengers in the developer's own system / ChatApp
Copied +55 (21) 960104492
Log In Free trial

Select a language

Embedding messengers in the developer's own system

WEB chat 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:

 https://chat.chatapp.online?crm[phones][0]=79585826158&api[license_id]=15006&api[messenger_type]=grWhatsApp

link parameters:

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

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

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

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

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

Any software system can integrate ChatApp WEB 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 convenience, 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' => [
        'phones' => [
            '79954545454',
            '79985554544',
            '79985554513',
        ]
    ],
];

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);
Connection code iframe:
<iframe
       id="webchat"
       src="https://chat.chatapp.online/?<?=$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://chat.chatapp.online/; microphone https://chat.chatapp.online/; clipboard-read https://chat.chatapp.online/; clipboard-write https://chat.chatapp.online/"
       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.
crm[phones]Phone array. Used to filter dialogs.

All fields are optional.

Note:
ChatApp WEB, 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 web chat itself manages the freshness of its token and refreshes it if necessary.
Important: pass a live access_token to ChatApp WEB at the time of opening the frame.

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

Встройка мессенджеров в систему