This article describes how to configure scripts for sending webhooks for chats in Telegram or to an external system. Scripts for webhooks are configured separately from the main script.
Full integration of the bot with chat is not necessary, as the bot will only be used to send notifications.
Go to the Bots section of personal account.
Create a new scenario.
Set the Result block.
Add the following variables to the block:
text - notification text. Specify variables from your main bot to be sent to telegram.bot_token - token of your bot, generated by BotFather, to which notifications will be sent.chat_id - identifier of the chat where the notification will be sent. To get it, use the bot command /getid.Set the Request block.
Click Open request editor in the block in the Request field.
Click the cURL tab.
Paste the following code:
curl 'https://api.telegram.org/bot{bot_token}/sendMessage' -X 'POST' -H 'Content-Type: application/json' --data-raw '{"chat_id":"{chat_id}","parse_mode":"HTML","text":"{text}"}'
Go to the Bots section of personal account.
Create a new script.
Set the Request block.
Click Open request editor in the block in the Request field.
Fill in the following fields in the block:
All variables transferred from one script to another are saved
{
“Name": ”Peter”,
“Phone": ”79000000000”
}
Go to Chat bots → Settings in your personal cabinet.
Hover your cursor over the bot whose information you want to send to Telegram or an external system and click
.
Select a previously created script from the drop-down list in the window that opens in the fields:
Click Save.
Now, when the bot terminates or its session lifetime expires, it will be transferred to the specified script, from which all the specified variables will be sent to Telegram chat or to an external system.