airflow.providers.discord.operators.discord_webhook

Module Contents

Classes

DiscordWebhookOperator

This operator allows you to post messages to Discord using incoming webhooks.

class airflow.providers.discord.operators.discord_webhook.DiscordWebhookOperator(*, http_conn_id=None, webhook_endpoint=None, message='', username=None, avatar_url=None, tts=False, proxy=None, **kwargs)[source]

Bases: airflow.providers.http.operators.http.HttpOperator

This operator allows you to post messages to Discord using incoming webhooks.

Takes a Discord connection ID with a default relative webhook endpoint. The default endpoint can be overridden using the webhook_endpoint parameter (https://discordapp.com/developers/docs/resources/webhook).

Each Discord webhook can be pre-configured to use a specific username and avatar_url. You can override these defaults in this operator.

Parameters
  • http_conn_id (str | None) – Http connection ID with host as “https://discord.com/api/” and default webhook endpoint in the extra field in the form of {“webhook_endpoint”: “webhooks/{webhook.id}/{webhook.token}”}

  • webhook_endpoint (str | None) – Discord webhook endpoint in the form of “webhooks/{webhook.id}/{webhook.token}” (templated)

  • message (str) – The message you want to send to your Discord channel (max 2000 characters). (templated)

  • username (str | None) – Override the default username of the webhook. (templated)

  • avatar_url (str | None) – Override the default avatar of the webhook

  • tts (bool) – Is a text-to-speech message

  • proxy (str | None) – Proxy to use to make the Discord webhook call

property hook: airflow.providers.discord.hooks.discord_webhook.DiscordWebhookHook[source]

Get Http Hook based on connection type.

template_fields: Sequence[str] = ('username', 'message', 'webhook_endpoint')[source]
execute(context)[source]

Call the DiscordWebhookHook to post a message.

Was this entry helpful?