SlackWebhookOperator

Slack

This operator allows you to post messages to Slack using Incoming Webhooks.

View on GitHub

Last Updated: Oct. 23, 2022

Access Instructions

Install the Slack provider package into your Airflow environment.

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

Parameters

slack_webhook_conn_idSlack Incoming Webhook connection id that has Incoming Webhook token in the password field.
messageThe formatted text of the message to be published. If blocks are included, this will become the fallback text used in notifications.
attachmentsThe attachments to send on Slack. Should be a list of dictionaries representing Slack attachments.
blocksThe blocks to send on Slack. Should be a list of dictionaries representing Slack blocks.
channelThe channel the message should be posted to
usernameThe username to post to slack with
icon_emojiThe emoji to use as icon for the user posting to Slack
icon_urlThe icon image URL string to use in place of the default icon.
link_namesWhether or not to find and link channel and usernames in your message
proxyProxy to use to make the Slack webhook call
webhook_token(deprecated) Slack Incoming Webhook token. Please use slack_webhook_conn_id instead.

Documentation

This operator allows you to post messages to Slack using Incoming Webhooks.

Note

You cannot override the default channel (chosen by the user who installed your app), username, or icon when you’re using Incoming Webhooks to post messages. Instead, these values will always inherit from the associated Slack App configuration (link). It is possible to change this values only in Legacy Slack Integration Incoming Webhook.

Warning

This operator could take Slack Webhook Token from webhook_token as well as from Slack Incoming Webhook connection. However, provide webhook_token it is not secure and this attribute will be removed in the future version of provider.

Was this page helpful?