Open Messenger Window BX24.im.openMessenger

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

The application runs in an iframe

An application runs inside its own iframe on a different origin. The Bitrix24 runtime is not available there — neither Messenger.* nor BX.Runtime.loadExtension can be reached from the application.

The only channel outward is the parent bridge: the BX24.im.* methods, or their equivalents $b24.parent.imCallTo, $b24.parent.imPhoneTo, $b24.parent.imOpenMessenger, and $b24.parent.imOpenHistory in the b24jssdk library.

Calling these methods prints a deprecation notice in the Bitrix24 console that recommends Messenger.startVideoCall, Messenger.startPhoneCall, or Messenger.openChat. Disregard it: those are top-window methods, available only to code running on the Bitrix24 page itself, and they are not reachable from an application.

The im.public.iframe extension that the notice names is meant for an iframe on the Bitrix24 domain, not for an application frame. For that case, see Passing Context to the Bot When Opening a Chat.

BX24.im.openMessenger(dialogId?: string): void;
        

The BX24.im.openMessenger method opens the chat list or a selected dialog in Bitrix24 Messenger.

The method works after BX24.init.

Method Parameters

Name
type

Description

dialogId
string

Dialog identifier. Supported formats:

  • user identifier, for example, 42
  • chat identifier in the chatXXX format, for example, chat123
  • group chat identifier in the sgXXX format, for example, sg456
  • Open Channel dialog identifier in the imol\|XXXX format, for example, imol\|1234

If the parameter is not passed, the method opens the chat list

The method passes dialogId to Messenger without validation or conversion.

Code Example

How to Use Examples in Documentation

BX24.init(function () {
            BX24.im.openMessenger('chat123');
        });
        

Response Handling

The method sends a command to open Messenger and returns nothing.

Error Handling

The method does not pass error codes to the application. If dialogId does not match an available dialog, the application does not receive a description of the cause.

Continue Learning