<@ULVA73B9P> does the open source version of prefe...
# marvin-ai
c
@Marvin does the open source version of prefect allow alerting via teams or slack?
m
thought for 120.7 seconds
Yes. Prefect open source (3.x) can send alerts to both Slack and Microsoft Teams. - Slack: use either the Slack webhook notification block or the Slack integration - Block:
prefect.blocks.notifications.SlackWebhook
- Integration (Chat API): Prefect Slack integration docs - Microsoft Teams: use the
prefect.blocks.notifications.MicrosoftTeamsWebhook
block Typical usage (no Cloud required):
Copy code
from prefect import flow
from prefect.blocks.notifications import SlackWebhook, MicrosoftTeamsWebhook

@flow
def my_flow():
    try:
        # your work
        ...
    except Exception as e:
        # Send to Slack
        SlackWebhook.load("slack-alerts").notify(f"my_flow failed: {e}")
        # Or send to Teams
        # MicrosoftTeamsWebhook.load("teams-alerts").notify(f"my_flow failed: {e}")
        raise
Creating blocks: - Either create/save them in code:
Copy code
SlackWebhook(url="<https://hooks.slack.com/services/...>").save("slack-alerts", overwrite=True)
MicrosoftTeamsWebhook(url="<https://outlook.office.com/webhook/...>").save("teams-alerts", overwrite=True)
- Or create them in the UI, then
load(...)
by name in your flows. What’s Cloud-only: - Prefect Cloud adds Automations (event/state-based, policy-driven alerts) and team features. In OSS you’ll trigger notifications from your flow code (like above) or via your own monitoring flows. Docs and references: - Blocks API (Slack/Teams, others): Notification blocks API - Slack integration (Chat API helper tasks/blocks): Prefect Slack integration - Cloud vs OSS overview: Cloud vs OSS Note: If you ever see a missing dependency error related to notifications, install the suggested package (e.g., apprise) and retry.