Florent VanDeMoortele
12/18/2025, 10:54 AMMarvin
12/18/2025, 10:54 AMMarvin
12/18/2025, 10:58 AMprefect.blocks.notifications.SlackWebhook)
- Install: Included with Prefect (no extra package)
- Best for: Simple notifications from Prefect Automations/Notifications (UI-driven alerts)
- Capabilities: Plain-text messages via a Slack Incoming Webhook URL
- Docs: https://docs.prefect.io/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.SlackWebhook
- Source: https://github.com/PrefectHQ/prefect/blob/2.x/src/prefect/blocks/notifications.py
- Slack Incoming Webhook (prefect-slack collection)
- Where it lives: prefect-slack integration (prefect_slack.credentials.SlackWebhook)
- Install: pip install prefect-slack, then register blocks once:
prefect block register -m prefect_slack
- Best for: Sending messages from flows/tasks with richer formatting
- Capabilities: Supports Slack attachments and Block Kit blocks, async-friendly helpers
- Docs: https://docs.prefect.io/integrations/prefect-slack/credentials/#prefect_slack.credentials.SlackWebhook
- Source: https://github.com/PrefectHQ/prefect/blob/2.x/src/integrations/prefect-slack/prefect_slack/credentials.py
- Message helpers: https://github.com/PrefectHQ/prefect/blob/2.x/src/integrations/prefect-slack/prefect_slack/messages.py
Which one should you use?
- If you’re wiring up Prefect Cloud Automations/Notifications to Slack: use Slack Webhook (core).
- If you want to send Slack messages from inside your flows/tasks (especially with attachments/blocks): use Slack Incoming Webhook (prefect-slack).
Both blocks take the same kind of Slack Incoming Webhook URL; the difference is primarily where/how you use them and the richness of messages you want to send.
If you instead need to use the Slack Web API with a bot token (e.g., post in threads, DM users), look at prefect_slack.SlackCredentials and related tasks: https://docs.prefect.io/integrations/prefect-slack/credentials/
Quick examples
- Core block in an Automation (UI-driven) — configure the “Slack Webhook” block in the UI and select it in your Notification.
- In-flow message with prefect-slack:
from prefect_slack import SlackWebhook
from prefect_slack.messages import send_incoming_webhook_message
webhook = SlackWebhook.load("my-slack-incoming-webhook")
await send_incoming_webhook_message(
slack_webhook=webhook,
text="Flow finished ✅",
slack_blocks=[{"type": "section", "text": {"type": "mrkdwn", "text": "*Success!*"}}],
)
If you can share whether you’re setting up Cloud Automations or sending messages from inside a flow, I can recommend the exact setup (and code) to use.