Skip to content

feat: add alert function templates - #507

Merged
ChiragAgg5k merged 2 commits into
mainfrom
feat-alert-templates
Nov 20, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
feat-alert-templates

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Three Node templates that act on monitor alert events (monitors.*.alerts.*.firing / .resolved).

Template Monitors Does Scopes
node/alerts-to-chat all Posts firing/resolved alerts to Slack, Discord, Teams or Google Chat (detected from the webhook host, or CHAT_TARGET) none
node/pause-on-usage-spike usage Disables the function or site a usage monitor is scoped to, at MIN_SEVERITY+; ignores project-wide alerts and itself; never auto re-enables functions.*, sites.*
node/uptime-incident-log http/dns/tcp/smtp One incident row per alert in TablesDB (auto-created), resolved with downtime; optional Messaging topic notice by email/SMS/push databases, tables, rows, topics.read, messages.write
flowchart LR
  M[monitor] -->|alert event| F[template function]
  F -->|chat| S[Slack / Discord / Teams / Google Chat]
  F -->|pause| R[function / site enabled=false]
  F -->|incident| T[(status.incidents)] --> Rt[Realtime status page]
  F -->|notify| Tp[Messaging topic]
Loading
  • All three refuse anything but an event trigger (403), so a forged HTTP call to the function domain does nothing.
  • At-least-once delivery: pause is idempotent; incidents use the alert ID as row ID (a late firing never reopens a resolved one); topic messages use fixed IDs per incident and state.

Verified end to end against a local stack with real monitors (screenshots in the server PR). Needs a 1.6.0 tag after merge; the server config pins it.

Three Node templates that act on monitor alert events: alerts-to-chat posts firing and resolved alerts to Slack, Discord, Teams or Google Chat; pause-on-usage-spike disables the function or site a usage monitor is scoped to; uptime-incident-log records uptime alerts as incident rows and notifies a Messaging topic.
Alert IDs are 32 characters, so the state and channel suffix has to stay at three.
@appwrite

appwrite Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Code review

Commit Status Tier Verdict Details
8d692ca Reviewed Reviewed 🟢 S · Ready to merge ✅ Approved View review

Adds three Node.js templates for monitor alert events: chat notifications, pausing scoped resources on usage alerts, and recording uptime incidents with optional topic notifications. Each template includes setup documentation, dependency manifests and lockfiles, and its function implementation.

Walkthrough (3)
File Change
node/alerts-to-chat/* Documents and implements chat formatting and webhook delivery for firing and resolved alerts.
node/pause-on-usage-spike/* Documents and implements severity-gated disabling of scoped functions and sites.
node/uptime-incident-log/* Documents and implements incident table creation, idempotent row updates, and optional topic notifications.

Reviewed 8d692ca

Tip

Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ChiragAgg5k
ChiragAgg5k merged commit fe94981 into main Nov 20, 2026
28 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the feat-alert-templates branch November 20, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant