Area: Observability
Sub-Area: Notifications
Issue
Slack notifications for assertions, incidents, or other DataHub events are not being sent, or messages are not formatted correctly. This typically occurs due to incorrect webhook URL configuration, missing DataHub Actions setup, or Slack app permission issues.
Common Error Messages:
Failed to post to Slack webhookInvalid webhook URLSlack API error: missing_scopeConnection timeout to Slack
You Might Be Asking:
- How do I set up Slack notifications from DataHub?
- Why aren't Slack alerts being sent?
- Can I customize Slack message format?
Solution
- Create Slack webhook URL:
This is specific to Slack integration. The webhook URL setup process is specific to Slack's API.
1. Go to https://api.slack.com/apps
2. Create new app or select existing
3. Navigate to "Incoming Webhooks"
4. Activate Incoming Webhooks
5. Click "Add New Webhook to Workspace"
6. Select channel and authorize
7. Copy the webhook URL (starts with https://hooks.slack.com/services/)
- Configure Slack in DataHub Actions:
Example for Slack notifications. This can be adapted for other notification platforms like Microsoft Teams, email, or custom webhooks.
# actions-config.yml
name: "slack-notifications"
source:
type: "kafka"
config:
connection:
bootstrap: "kafka:9092"
consumer_group: "datahub-slack-notifications"
action:
type: "slack"
config:
webhook_url: "${SLACK_WEBHOOK_URL}"
# Optional: Default channel (overrides webhook default)
default_channel: "#data-alerts"
# Filters for events to send
filters:
event_type:
- "ASSERTION_RESULT"
- "INCIDENT_CREATED"
- "SCHEMA_CHANGE"
- Customize Slack message format:
Example for Slack block kit formatting. This can be adapted for other notification platforms with their respective message formatting.
action:
type: "slack"
config:
webhook_url: "${SLACK_WEBHOOK_URL}"
# Custom message template
message_template: |
{
"text": "DataHub Alert",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚨 {{ event.type }}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Dataset:*\n{{ dataset.name }}"
},
{
"type": "mrkdwn",
"text": "*Time:*\n{{ event.timestamp }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Details:*\n{{ event.description }}"
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View in DataHub"
},
"url": "{{ dataset.url }}"
}
]
}
]
}
- Test Slack integration:
# Test webhook manually
curl -X POST ${SLACK_WEBHOOK_URL} \
-H 'Content-Type: application/json' \
-d '{"text": "Test message from DataHub"}'
# Check DataHub Actions logs
kubectl logs -f deployment/datahub-actions | grep slack
# Trigger test notification from DataHub UI
# Settings → Notifications → Test Connection
- Route different alerts to different channels:
Example for Slack channel routing. This can be adapted for other notification platforms with channel/topic support.
action:
type: "slack"
config:
webhook_url: "${SLACK_WEBHOOK_URL}"
# Channel routing based on severity
channel_routing:
- condition:
event_type: "ASSERTION_RESULT"
severity: "CRITICAL"
channel: "#critical-alerts"
- condition:
event_type: "INCIDENT_CREATED"
priority: [0, 1] # P0, P1
channel: "#incidents"
- condition:
event_type: "SCHEMA_CHANGE"
channel: "#schema-changes"
# Default channel for everything else
default: "#data-alerts"
Additional Notes
Slack notifications require DataHub Actions to be running. For high-volume alerts, consider batching notifications or using digest messages. Test webhook connectivity from the DataHub Actions pod to ensure network access.
Related Documentation
Tags:
slack, notifications, alerts, webhooks, integrations, datahub-actions, messaging, monitoring