SlackAPIPostOperator

Slack

Posts messages to a slack channel Examples:

View on GitHub

Last Updated: Jun. 1, 2021

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

channelstrchannel in which to post message on slack name (#general) or ID (C12318391). (templated)
usernamestrUsername that airflow will be posting to Slack as. (templated)
textstrmessage to send to slack. (templated)
icon_urlstrurl to icon used for this message
attachmentslist of hashesextra formatting details. (templated) - see https://api.slack.com/docs/attachments.
blockslist of hashesextra block layouts. (templated) - see https://api.slack.com/reference/block-kit/blocks.

Documentation

Posts messages to a slack channel Examples:

slack = SlackAPIPostOperator(
task_id="post_hello",
dag=dag,
token="XXX",
text="hello there!",
channel="#random",
)

Was this page helpful?