Back to Nightingale

Notify rule HTTP API (for external A2A agents / when producing curl commands for the user)

aiagent/skill/embedded/builtin/notify-rule-copilot/http-api.md

9.1.12.4 KB
Original Source

Notify rule HTTP API (for external A2A agents / when producing curl commands for the user)

The in-app AI assistant should not use these endpoints (use the built-in FC tools); this file is for external agents operating programmatically, or for the in-app assistant to reference when explaining to a user "how to change it themselves with curl". Authentication: Authorization: Bearer <token>.

Path A: HTTP API (programmable)

OperationMethodPathNotes
ListGET/api/n9e/notify-rulesReturns only the rules under the current user's authorized teams
DetailGET/api/n9e/notify-rule/<id>
CreatePOST/api/n9e/notify-rulesBody must be an array, even when creating just 1: [{...}]
UpdatePUT/api/n9e/notify-rule/<id>Body is a single object and replaces wholesale — you must GET first, modify, then PUT
DeletePOST/api/n9e/notify-rules/delBody: {"ids":[1,2,3]}
Test sendPOST/api/n9e/notify-rule/testBody: {"event_ids":[<history_event_id>], "notify_config":{...}}
Fetch custom webhook paramsGET/api/n9e/notify-rule/custom-params?notify_channel_id=<id>Used to copy another rule's custom parameters
Available media listGET/api/n9e/notify-channel-configsGet channel_id
Template listGET/api/n9e/message-templates?channel_id=<id>Get template_id
Event label keysGET/api/n9e/event-tagkeysSelectable keys for label_keys

The correct way to edit:

text
1. GET /api/n9e/notify-rule/<id>      → get the complete NotifyRule JSON
2. Modify a field locally (e.g. notify_configs[1].severities = [1])
3. PUT /api/n9e/notify-rule/<id>      → submit the whole thing back

Do not attempt a partial PATCH update — PUT goes through Update(...).Select("*") (models/notify_rule.go), and fields not passed will be cleared.

Path B: UI

  • Entry: Alert management → Notify rules
  • Suitable for: users unfamiliar with the API, with few fields, who aren't comfortable with the JSON structure.

Path C: directly modify the DB (last resort)

  • Table notify_rule; notify_configs / pipeline_configs / user_group_ids are all JSON fields.
  • n9e has a NotifyRuleCache in memory; after a change, the cache layer auto-reloads it within ~9s, no restart needed.
  • Before changing, run mysqldump -t notify_rule > backup.sql.