blob: 6803427fb5f4416e19cc53190be937d6008350cf [file] [log] [blame]
:mod:`airflow.contrib.operators.discord_webhook_operator`
=========================================================
.. py:module:: airflow.contrib.operators.discord_webhook_operator
Module Contents
---------------
.. py:class:: DiscordWebhookOperator(http_conn_id=None, webhook_endpoint=None, message='', username=None, avatar_url=None, tts=False, proxy=None, *args, **kwargs)
Bases: :class:`airflow.operators.http_operator.SimpleHttpOperator`
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.
:param http_conn_id: 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}"}
:type http_conn_id: str
:param webhook_endpoint: Discord webhook endpoint in the form of
"webhooks/{webhook.id}/{webhook.token}"
:type webhook_endpoint: str
:param message: The message you want to send to your Discord channel
(max 2000 characters). (templated)
:type message: str
:param username: Override the default username of the webhook. (templated)
:type username: str
:param avatar_url: Override the default avatar of the webhook
:type avatar_url: str
:param tts: Is a text-to-speech message
:type tts: bool
:param proxy: Proxy to use to make the Discord webhook call
:type proxy: str
.. attribute:: template_fields
:annotation: = ['username', 'message']
.. method:: execute(self, context)
Call the DiscordWebhookHook to post message