ruLog in to Senler

Interactive widget step

The Interactive widget step sends an HTML, CSS, and JavaScript message to the current website widget conversation or private Telegram conversation with the bot. Buttons inside the message start the selected automation branches. Other platforms and group chats are not supported.

Send a widget

Add the step from the catalog. In the widget settings, choose Send widget. Fill in the HTML, CSS, and JS tabs in the code editor: they form one document. The line wrapping button makes long lines easier to read. Below the editor, you can add a message caption of up to 1024 characters.

Telegram widget step. Highlighted elements: 1. widget settings; 2. code editor; 3. line wrapping button
1. widget settings · 2. code editor · 3. line wrapping button

In Advanced settings:

  • Accept one choice is on by default. Turn it off to allow repeated clicks.
  • Continue after sending adds the regular step output. When off, execution continues through the selected action output.
  • Width and height are automatic by default. When set manually, width is 200–600 px and height is 50–600 px.

Connect the required outputs to subsequent steps. Save, test, and publish the automation. Real messages use the shared message allowance; test dialogs do not consume it.

Pass data from variables

In Widget data, click Add. In the field dialog, specify the JSON field name, the variable scope — run, lead, dialog, or project — and the variable name. For example, the name field can use the client.name run variable.

Telegram widget step. 1. field dialog
1. field dialog

The pencil lets you edit the field; the trash icon removes it from widget data. This does not delete the source variable. You can add up to 20 fields. Names must be unique, start with a Latin letter, and contain up to 32 Latin letters, digits, or underscores. The names constructor and prototype are reserved.

Values are read when the step runs and passed as JSON in TelegramWidget.chatData. Use JSON.parse(TelegramWidget.chatData) in your code. For content that can change, subscribe to chatDataChanged and render the data again. Set user-provided text with textContent.

Configure button actions

In dialog history, the Interactive widget card displays a preview. If the preview stops or becomes unavailable, an explanation and a restart button appear below the card.

Interactive widget step. 1. Interactive widget card
1. Interactive widget card

In Actions, click Add. In the action dialog, enter a clear title of up to 40 characters and a unique key, such as confirm. Keys follow the same rules as JSON field names. The title appears on the step output; the button's own label is set in HTML.

Telegram widget step. 1. action dialog
1. action dialog

Call TelegramWidget.request("confirm:yes") in the button's JavaScript: the key before the first colon selects the action, and the text after it is the value. In Save value, you can specify a run variable such as answer.choice, which will receive the string yes. Without a colon, the value is an empty string. The entire request must fit within 64 UTF-8 bytes.

You can create up to 10 actions. The pencil opens action editing; the trash icon removes the action. After changing a key, update the call in your code. After changing the list, check the output connections on the canvas.

Telegram widget step. Highlighted elements: 1. Add; 2. edit the field; 3. removes it from widget data; 4. Add; 5. action editing; 6. removes the action
1. Add · 2. edit the field · 3. removes it from widget data · 4. Add · 5. action editing · 6. removes the action

Check the code and preview

For long lines, enable wrapping in the regular editor first: it stays enabled when expanded. Click Expand editor to open code and preview. It has its own line wrapping button. On a narrow screen, switch between Widget code and Preview. Check widths of 320, 360, or 430 px and the light or dark theme; the refresh button restarts the preview.

Telegram widget step. Highlighted elements: 1. code and preview; 2. line wrapping button
1. code and preview · 2. line wrapping button

The preview uses empty sample data, {}. Provide fallback values in your code. Clicking a button shows the action title and request string, or reports an unknown key. It does not run the automation, open links, or send a customer message. Check step connections in automation testing.

The complete HTML, CSS, and JS document is limited to 32,768 UTF-8 bytes and 4096 compressed bytes; the compressed size is checked on save. Widget data is limited to 1024 bytes. Network requests, external libraries, forms, and media are unavailable. The counter below the editor shows the source document size, not its compressed size.

Update a sent widget

Add another Interactive widget step and choose Update widget data. Select the automation with the widget — the current automation or another published automation in this project — and the widget sending step. After changing the automation, select the step again.

Telegram widget step. Highlighted elements: 1. automation with the widget; 2. widget sending step
1. automation with the widget · 2. widget sending step

Specify the complete field set in Widget data: an update replaces the entire JSON rather than adding individual fields. This action does not change the code or caption of the sent widget. The process continues once the update is accepted; this does not confirm that the customer has already seen the changes.

The system selects the most recent actual send from the selected step within the last 30 days in the current website widget conversation or private Telegram dialog, including other runs. A retry updates the same pinned message. If no suitable widget exists or it has been deleted, the step fails. To remove the message, use Delete message.