DiscordWebhookOperator

Discord

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).

View Source

Last Updated: Oct. 20, 2020

Access Instructions

Install the Discord provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

http_conn_idstrHttp 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_endpointstrDiscord webhook endpoint in the form of "webhooks/{webhook.id}/{webhook.token}"
messagestrThe message you want to send to your Discord channel (max 2000 characters). (templated)
usernamestrOverride the default username of the webhook. (templated)
avatar_urlstrOverride the default avatar of the webhook
ttsboolIs a text-to-speech message
proxystrProxy to use to make the Discord webhook call

Documentation

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.

Example DAGs

Improve this module by creating an example DAG.

View Source
  1. Add an `example_dags` directory to the top-level source of the provider package with an empty `__init__.py` file.
  2. Add your DAG to this directory. Be sure to include a well-written and descriptive docstring
  3. Create a pull request against the source code. Once the package gets released, your DAG will show up on the Registry.

Was this page helpful?