Telegram

Telegram

This filter allows you to download files received from the Telegram feeder or send messages.
Note: it can be used only in a rule with the Telegram Feeder.

Parameters

The following parameters are required from this filter:

ParameterTypeDefaultDescription
actionSTRING“send_message”action to perform: “send_message”, “download_file”
toSTRING""used with action send_message, it has to contain the recipient of the message: username, @username, phone number with the country code (supports Golang templates)
to_chatidSTRINGemptythe recipient of the message will be a chat
filenameSTRING""specified the path of where to store the downloaded file: msg_filename in the extra will contain the name of the file (supports Golang templates)
textSTRING""the text of the file (supports Golang templates)

Each action can use different parameters:

action = send_message

ParameterTypeDefaultDescription
toSTRING""used with action send_message, it has to contain the recipient of the message: username, @username, phone number with the country code (supports Golang templates)
to_chatidSTRINGemptythe recipient of the message will be a chat
textSTRING""the text of the file (supports Golang templates)

action = download_file

ParameterTypeDefaultDescription
filenameSTRING""specified the path of where to store the downloaded file: msg_filename in the extra will contain the name of the file (supports Golang templates)
... | telegram(action="send_message", to="@username", text="the file '{{ .msg_filename }}' received from {{ .user_username }} has been downloaded.") | ...

Examples

telegramRule => <telegram: app_id="xxx", app_hash="yyyy", phone_number="+1123654789", session_folder="/tmp/sessions"> | text(target="chan_id", pattern="123456") | telegram(action="download_file", filename="/tmp/{{ .msg_filename }}") | telegram(action="send_message", to="@username", text="the file '{{ .msg_filename }}' received from {{ .user_username }} has been downloaded.")
telegramRule => <telegram: app_id="xxx", app_hash="yyyy", phone_number="+1123654789", session_folder="/tmp/sessions"> | text(target="main", pattern="help") | telegram(action="send_message", to="{{ .user_username }}", text="Hi {{ .user_username }}! You wrote the following message: {{ .main }}.")