TelegramOperator

Use the TelegramOperator to send message to a Telegram group or a specific chat.

Using the Operator

Use the telegram_conn_id argument to connect to Telegram client where the connection metadata is structured as follows:

Telegram Connection Metadata

Parameter

Input

Password: string

Telegram Bot API Token

Host: string

Chat ID of the Telegram group/chat

Connection Type: string

telegram as connection type

An example usage of the TelegramOperator is as follows:

tests/system/telegram/example_telegram.py[source]


    send_message_telegram_task = TelegramOperator(
        task_id="send_message_telegram",
        telegram_conn_id=CONN_ID,
        chat_id=CHAT_ID,
        text="Hello from Airflow!",
        dag=dag,
    )

Note

Parameters that can be passed onto the operator will be given priority over the parameters already given in the Airflow connection metadata (such as Host, Password and so forth).

Was this entry helpful?