Webhook from Telegram
What is a webhook?
This is a notification about an event that has occurred. This notification contains the values of the changed variables.
How to get webhook?
To get a complete webhook from Telegram, it is enough to assign any value to the save_webhook variable:
Example save_webhook = 'text value'

Example: numeric variable value

The save_webhook variable can be either a project constant or a variable in the calculator (examples above):

In this case, the client's response to the bot message, which contains such a variable, will be recorded in the Telegram variable tg_request, which you can find in the client's card among the transaction variables.

The client responded to the bot's message from the block in which the save_webhook variable is assigned.
tg_request and save_webhook in client variable

How to get a media link using a variable?
You can use the tg_request function to obtain a direct download link for a video, image, or animation sent by a user.
Implementation steps:
Set up the webhook variable: First, assign any value to a variable named
save_webhook. You can define this as a project constant or a variable within a Calculator block.Create the Trigger block: Next, create a Trigger block. This block will listen for incoming media and use the
tg_requestfunction with yoursave_webhookvariable to capture the file link.

Next, create a block to output the result.

Follow these steps to get a direct link to a file from your bot:
Go to your connected Telegram bot and start a chat.
Type your designated keyword to activate the file request function.
Send the file (image, video, etc.) for which you want to receive the downloadable link.

Pay attention in the last file_id in the received Telegram response:

Do not forget that the received link is valid only within the bot framework to which you sent the file.
Last updated