blob: 8760e9b6ecf69504222fca614259d3e308f8b4fb [file] [log] [blame]
:py:mod:`airflow.providers.slack.operators.slack_webhook`
=========================================================
.. py:module:: airflow.providers.slack.operators.slack_webhook
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.slack.operators.slack_webhook.SlackWebhookOperator
.. py:class:: SlackWebhookOperator(*, http_conn_id, webhook_token = None, message = '', attachments = None, blocks = None, channel = None, username = None, icon_emoji = None, icon_url = None, link_names = False, proxy = None, **kwargs)
Bases: :py:obj:`airflow.providers.http.operators.http.SimpleHttpOperator`
This operator allows you to post messages to Slack using incoming webhooks.
Takes both Slack webhook token directly and connection that has Slack webhook token.
If both supplied, http_conn_id will be used as base_url,
and webhook_token will be taken as endpoint, the relative path of the url.
Each Slack webhook token can be pre-configured to use a specific channel, username and
icon. You can override these defaults in this hook.
:param http_conn_id: connection that has Slack webhook token in the extra field
:param webhook_token: Slack webhook token
:param message: The message you want to send on Slack
:param attachments: The attachments to send on Slack. Should be a list of
dictionaries representing Slack attachments.
:param blocks: The blocks to send on Slack. Should be a list of
dictionaries representing Slack blocks.
:param channel: The channel the message should be posted to
:param username: The username to post to slack with
:param icon_emoji: The emoji to use as icon for the user posting to Slack
:param icon_url: The icon image URL string to use in place of the default icon.
:param link_names: Whether or not to find and link channel and usernames in your
message
:param proxy: Proxy to use to make the Slack webhook call
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['webhook_token', 'message', 'attachments', 'blocks', 'channel', 'username', 'proxy']
.. py:method:: execute(context)
Call the SlackWebhookHook to post the provided Slack message