Documentation

Chat provider

Chat provider

"Chat" entity has the im-chat ID and is implemented by the class \Bitrix\Im\Integration\UI\EntitySelector\ChatProvider.

This provider implements search and selection of chats, 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-chat', // чаты
            options: { 
                searchableChatTypes: [ // chat types to be searched
                    'C', // group chats
                    'L', // open channel chats
                    'O', // channels
                ] 
            } 
        },
    ],
});
    
button.addEventListener('click', function() {
    dialog.show();
});

Provider settings


  • searchableChatTypes: array

    Chat types to be searched.
    List of chat types available for search:

    • C — group chats.
    • L — open channel chats.
    • O — channels.

Search logic

  • When intranet user performs the search:
    • Group chats (C): searches all chats with the intranet user as a member.
    • Open channel chats (L): searches all chats with the intranet user as a member.
    • Channels (O): searches all chats.
  • When extranet user performs the search:
    • Group chats (C): searches all chats with the extranet user as a member.
    • Open channel chats (L): doesn't search in this chat type.
    • Channels (O): doesn't search in this chat type.

Output sorting

  • Upon first completing: the later the chat was created, the higher it is in the sorting.
  • When searching: the later the message in chat, the higher it is in the sorting.

Additional information about the chat (customData)

Each dialog item property customData has the key imChat, containing information about chat in format similar to \Bitrix\Im\Chat::getList($params). You can found more information about the data format in this documentation.

© «Bitrix24», 2001-2024