π¬ Slack Integration
Get real-time pipeline notifications, drift alerts, and team collaboration messages delivered directly to your Slack channels.
π Pipeline Alerts π Drift Notifications π₯ Team Updates
π¬ Slack Integration
What you'll learn
How to send pipeline alerts to Slack channels β don't watch the terminal, let the bot tell you when it's done.
Get notified where you work. Receive alerts for pipeline successes, failures, and approval requests directly in Slack.
Why Slack Alerts?
| Feature | Benefit |
|---|---|
| Real-time | Know immediately when a production job fails |
| Visibility | Keep the whole team in the loop |
| Actionable | Links to logs and dashboards in the message |
| Low friction | No context switching β alerts come to you |
π¬ Setup
1. Create a Slack Webhook
- Go to Slack API: Incoming Webhooks
- Create a new app or use an existing one
- Enable Incoming Webhooks and generate a webhook URL
- Copy the URL (format:
https://hooks.slack.com/services/T.../B.../...)
2. Configure FlowyML
from flowyml import configure_notifications
configure_notifications(
slack_webhook="https://hooks.slack.com/services/T000/B000/XXXX",
)
Or via environment variable:
π Sending Alerts
From Steps
from flowyml import get_notifier, step
@step
def notify_team(metrics):
get_notifier().notify(
title="π Training Finished",
message=f"Accuracy: {metrics['acc']:.2%}\nF1: {metrics['f1']:.2f}",
level="success",
channels=["slack"],
)
On Failure (Automatic)
from flowyml import step, on_failure
@step(
on_failure=on_failure(
action="slack",
recipients=["#ml-ops"],
include_logs=True,
)
)
def critical_step():
"""Automatically sends a Slack alert with logs if this step fails."""
return train_model()
Alert Levels
| Level | Slack Color | Use Case |
|---|---|---|
"info" |
Blue | Pipeline started, progress updates |
"success" |
Green | Training complete, deployment successful |
"warning" |
Yellow | Drift detected, degraded performance |
"error" |
Red | Step failure, pipeline crash |
Best Practices
Channel strategy
Use #ml-ops for all alerts, #ml-alerts-critical for errors only. Avoid sending success messages to high-traffic channels.
Webhook security
Store webhook URLs in environment variables or secrets β never hardcode them in source code.
π What's Next?
π Notifications
Configure advanced notification rules, schedules, and multi-channel delivery.
π Data Drift Detection
Detect and alert on data drift with automatic monitoring and Slack notifications.