Documentation

Chatbot provider

Chat provider

"Chatbot" provider has the im-bot ID and is implemented by the class \Bitrix\Im\Integration\UI\EntitySelector\BotProvider.

This provider implements search and selection of chatbots, as well as completes the "Recent" tab with data to avoid it being empty.

Chat selection dialog

const button = document.getElementById('responsible-button');
const dialog = new Dialog({
    targetNode: button,
    enableSearch: true,
    context: 'MY_MODULE_CONTEXT',
    entities: [
        { 
            id: 'im-bot', // чат боты
            options: { 
                searchableBotTypes: [ // chatbot types to be searched
                    'H', // chatbot - person, replies are issued with delay from 2 to 10 seconds
                    'B', // chatbot with replies issued immediately
                    'S', // chatbot with advanced privileges
                ] 
            }
        },
    ],
});
    
button.addEventListener('click', function() {
    dialog.show();
});

Provider settings


  • searchableBotTypes: array

    Chatbot types to be searched.
    List of chatbots available for search:

    • H — chatbot - person, replies are issued with delay from 2 to 10 seconds.
    • B — chatbot with replies issued immediately.
    • S — chatbot with advanced privileges.

Output sorting

The more messages you have submitted to a chatbot, the higher it is in the list.

Additional information about chatbot (customData)

Each dialog item property customData has the following keys:

  • imBot containing the chatbot information in format, similar to \Bitrix\Im\Bot::getCache(<ID бота>);
  • imUser containing the chatbot information about the user in format similar to \Bitrix\Im\User::getList($params).

You can find out more about data format in the documentation.

© «Bitrix24», 2001-2024
Up