Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

Slack Incoming Webhook Operators

SlackWebhookOperator

Use the SlackWebhookOperator to post messages to predefined Slack channel through Incoming Webhook

Using the Operator

You could send simple text message

tests/system/slack/example_slack_webhook.py[source]

slack_webhook_operator_text = SlackWebhookOperator(
    task_id="slack_webhook_send_text",
    slack_webhook_conn_id=SLACK_WEBHOOK_CONN_ID,
    message=(
        "Apache Airflow® is an open-source platform for developing, "
        "scheduling, and monitoring batch-oriented workflows."
    ),
)

Or you could use Block Kit for create app layouts

tests/system/slack/example_slack_webhook.py[source]

slack_webhook_operator_blocks = SlackWebhookOperator(
    task_id="slack_webhook_send_blocks",
    slack_webhook_conn_id=SLACK_WEBHOOK_CONN_ID,
    blocks=[
        {
            "type": "section",
            "text": {
                "type": "mrkdwn",
                "text": (
                    "*<https://github.com/apache/airflow|Apache Airflow®>* "
                    "is an open-source platform for developing, scheduling, "
                    "and monitoring batch-oriented workflows."
                ),
            },
            "accessory": {"type": "image", "image_url": IMAGE_URL, "alt_text": "Pinwheel"},
        }
    ],
    message="Fallback message",
)

Was this entry helpful?