blob: 9131dcb36ab8b2c137040fd3d176aef7c9baaff2 [file] [log] [blame]
:py:mod:`airflow.providers.slack.hooks.slack_webhook`
=====================================================
.. py:module:: airflow.providers.slack.hooks.slack_webhook
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.slack.hooks.slack_webhook.SlackWebhookHook
.. py:class:: SlackWebhookHook(http_conn_id=None, webhook_token=None, message='', attachments=None, blocks=None, channel=None, username=None, icon_emoji=None, icon_url=None, link_names=False, proxy=None, *args, **kwargs)
Bases: :py:obj:`airflow.providers.http.hooks.http.HttpHook`
This hook 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 password 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:: conn_name_attr
:annotation: = http_conn_id
.. py:attribute:: default_conn_name
:annotation: = slack_default
.. py:attribute:: conn_type
:annotation: = slackwebhook
.. py:attribute:: hook_name
:annotation: = Slack Webhook
.. py:method:: execute(self)
Remote Popen (actually execute the slack webhook call)