Contextual Applications

You can read about what contextual applications are here.

To work with the context, follow these steps:

  1. Register an application. You can register a hidden application so that it does not appear on the text input panel.

  2. Send (or update) any message with an attached keyboard or with a menu.

  3. In the button parameters of the keyboard or menu item, you need to pass the application ID.

Examples

Note

This example uses the restCommand function. This is a method for sending data to Bitrix24. You can use your own function to call the method, the JavaScript method BX24.callMethod or industry standard B24PhpSDK.

restCommand(
            'imbot.message.add',
            Array(
                "DIALOG_ID" => 2,
                "BOT_ID" => 17,
                "MESSAGE" => "Hello! My name is EchoBot :)",
                "KEYBOARD" => [
                    {
                        "TEXT":"Open App",
                        "APP_ID":11
                    }
                ],
                "MENU" => [
                    {
                        "TEXT":"Open App",
                        "APP_ID":11
                    }
                ]
            ),
            $_REQUEST["auth"]
        );
        

How to Use Examples in Documentation

Note

In addition to APP_ID, you can pass any string in the APP_PARAMS parameter. When your IFRAME opens, the data will be passed to the BUTTON_PARAMS parameter.

The rules for developing the IFRAME handler and limitations are presented in the documentation. When creating a message, you can use one of two options — keyboard (KEYBOARD) or context menu (MENU).