SlackAPIPostOperator

Slack

Posts messages to a slack channel Examples:

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

channelchannel in which to post message on slack name (#general) or ID (C12318391). (templated)
usernameUsername that airflow will be posting to Slack as. (templated)
textmessage to send to slack. (templated)
icon_urlurl to icon used for this message
attachmentsextra formatting details. (templated) - see https://api.slack.com/docs/attachments.
blocksextra 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?