airflow.providers.slack.hooks.slack_webhook

Module Contents

Classes

SlackWebhookHook

This hook allows you to post messages to Slack using incoming webhooks.

class airflow.providers.slack.hooks.slack_webhook.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)[source]

Bases: 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.

Parameters
  • http_conn_id – connection that has Slack webhook token in the password field

  • webhook_token – Slack webhook token

  • message – The message you want to send on Slack

  • attachments – The attachments to send on Slack. Should be a list of dictionaries representing Slack attachments.

  • blocks – The blocks to send on Slack. Should be a list of dictionaries representing Slack blocks.

  • channel – The channel the message should be posted to

  • username – The username to post to slack with

  • icon_emoji – The emoji to use as icon for the user posting to Slack

  • icon_url – The icon image URL string to use in place of the default icon.

  • link_names – Whether or not to find and link channel and usernames in your message

  • proxy – Proxy to use to make the Slack webhook call

conn_name_attr = http_conn_id[source]
default_conn_name = slack_default[source]
conn_type = slackwebhook[source]
hook_name = Slack Webhook[source]
execute()[source]

Remote Popen (actually execute the slack webhook call)

Was this entry helpful?