airflow.providers.telegram.operators.telegram

Operator for Telegram.

Classes

TelegramOperator

This operator allows you to post messages to Telegram using Telegram Bot API.

TelegramFileOperator

This operator allows you to send file to Telegram using Telegram Bot API.

Module Contents

class airflow.providers.telegram.operators.telegram.TelegramOperator(*, telegram_conn_id='telegram_default', token=None, chat_id=None, text='No message has been set.', telegram_kwargs=None, **kwargs)[source]

Bases: airflow.providers.common.compat.sdk.BaseOperator

This operator allows you to post messages to Telegram using Telegram Bot API.

Takes both Telegram Bot API token directly or connection that has Telegram token in password field. If both supplied, token parameter will be given precedence.

See also

For more information on how to use this operator, take a look at the guide: TelegramOperator

Parameters:
  • telegram_conn_id (str) – Telegram connection ID which its password is Telegram API token

  • token (str | None) – Telegram API Token

  • chat_id (str | None) – Telegram chat ID for a chat/channel/group

  • text (str) – Message to be sent on telegram

  • telegram_kwargs (dict | None) – Extra args to be passed to telegram client

template_fields: collections.abc.Sequence[str] = ('text', 'chat_id')[source]
ui_color = '#FFBA40'[source]
chat_id = None[source]
token = None[source]
telegram_kwargs[source]
text = 'No message has been set.'[source]
telegram_conn_id = 'telegram_default'[source]
execute(context)[source]

Call the TelegramHook to post the provided Telegram message.

class airflow.providers.telegram.operators.telegram.TelegramFileOperator(*, telegram_conn_id='telegram_default', token=None, chat_id=None, file, telegram_kwargs=None, **kwargs)[source]

Bases: airflow.providers.common.compat.sdk.BaseOperator

This operator allows you to send file to Telegram using Telegram Bot API.

Takes both Telegram Bot API token directly or connection that has Telegram token in password field. If both supplied, token parameter will be given precedence.

See also

For more information on how to use this operator, take a look at the guide: TelegramOperator

Parameters:
  • telegram_conn_id (str) – Telegram connection ID which its password is Telegram API token

  • token (str | None) – Telegram API Token

  • chat_id (str | None) – Telegram chat ID for a chat/channel/group

  • file (str) – The path of the file or media to be sent via Telegram

  • telegram_kwargs (dict | None) – Extra args to be passed to telegram client

template_fields: collections.abc.Sequence[str] = 'chat_id'[source]
ui_color = '#FFBA40'[source]
chat_id = None[source]
token = None[source]
telegram_kwargs[source]
file[source]
telegram_conn_id = 'telegram_default'[source]
execute(context)[source]

Call the TelegramHook to send the provided Telegram file.

Was this entry helpful?