Documentation

getMessengerLink

\Bitrix\ImOpenLines\Tracker::getMessengerLink($lineId, $connectorId, $crmEntities)

Method gets link to Telegram bot with start parameter with associated listed CRM objects. Customer follows the link, starts an Open channel conversation at the Bitrix24 instance. CRM connects to this chat and creates an Activity - incoming open channel conversation.


Returns structure with two links

array{web: string, mob: string}

- for browser: https://t.me/bot_name?start=xxxx

- for mobile device: tg://resolve?domain=bot_name&start=xxxx


Parameters

Parameter FormatDescription Available from version
$lineId intChannel ID.
$connectorId stringChannel ID.
$crmEntities arrayArray with CRM object IDs to associate the conversation.


Example

$tracker = \Bitrix\Main\DI\ServiceLocator::getInstance()->get('ImOpenLines.Services.Tracker');

$tracker->getMessengerLink(
         $lineId,
         'telegrambot',
         [
            [
                'ENTITY_TYPE_ID' => \CCrmOwnerType::Deal,
                'ENTITY_ID' => 89,
            ],
            [
                'ENTITY_TYPE_ID' => \CCrmOwnerType::Contact,
                'ENTITY_ID' => 83,
            ],
            [
                'ENTITY_TYPE_ID' => \CCrmOwnerType::Company,
                'ENTITY_ID' => 83,
            ],
            [
                'ENTITY_TYPE_ID' => \CCrmOwnerType::Lead,
                'ENTITY_ID' => 83,
            ],
        ]
);


© «Bitrix24», 2001-2024