feat: Webhook & Slack/Discord alerting integrations#249
Open
vivekchand wants to merge 1 commit intomainfrom
Open
feat: Webhook & Slack/Discord alerting integrations#249vivekchand wants to merge 1 commit intomainfrom
vivekchand wants to merge 1 commit intomainfrom
Conversation
- Add _send_slack_alert() with rich attachment format (color-coded by severity) - Add _send_discord_alert() with Discord embed format (color-coded by severity) - Add _get_alert_channels() / _dispatch_alert_to_channels() helpers - All _fire_alert() calls now auto-dispatch to configured channels - Add alert_channels DB table (v2 schema: id, name, type, webhook_url, enabled, timestamps) - Migration: auto-detect & recreate table if old v1 schema (config column) detected - New API endpoints: GET/POST /api/alerts/channels — list or create channel integrations PUT/DELETE /api/alerts/channels/<id> — update or remove a channel POST /api/alerts/channels/<id>/test — send test alert to a specific channel - Budget & Alerts modal: new Integrations tab with add/test/delete UI - 10 new tests, all 143 pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #204
What
Push alert notifications to Slack, Discord, or arbitrary webhooks when ClawMetry fires budget/cost/agent alerts.
How
New alert dispatch functions:
_send_slack_alert(url, message, alert_type)— uses Slack incoming webhook format with colored attachments_send_discord_alert(url, message, alert_type)— uses Discord embed format with color-coded severity_dispatch_alert_to_channels(message, alert_type)— dispatches to all enabled channels; called from_fire_alert()New
alert_channelsDB table (v2 schema):id, name, type, webhook_url, enabled, timestampsconfigcolumn) is presentNew API endpoints:
GET /api/alerts/channels— list configured integrationsPOST /api/alerts/channels— add new integration (type: slack|discord|webhook)PUT /api/alerts/channels/<id>— update name, url, or enabled stateDELETE /api/alerts/channels/<id>— remove an integrationPOST /api/alerts/channels/<id>/test— send a test alert to verify setupBudget & Alerts modal UI:
Tests
10 new tests across
TestAlertChannelsclass: create Slack/Discord/webhook channels, reject invalid type/missing URL, list channels, schema validation, delete, update enabled state.All 143 tests pass.