Public
Like
1
vercelAlertToDiscord
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://jamiedubs--cce1c488a3e111f0b8380224a6c84d84.web.val.run
A webhook handler that receives Vercel alerts and posts them as detailed, formatted messages to a Discord channel.
-
Environment Variable: Set
DISCORD_WEBHOOK_URLto your Discord webhook URL- In Discord: Server Settings → Integrations → Webhooks → Create Webhook
- Copy the webhook URL and add it as an environment variable
-
Vercel Configuration:
- Go to your Vercel project settings
- Navigate to Webhooks section
- Add this Val's HTTP endpoint as a webhook URL
- Select the events you want to monitor (e.g., deployment alerts, usage anomalies)
- ✅ Handles Vercel webhook payloads with proper nested data extraction
- ✅ Rich Discord embeds with comprehensive error information
- ✅ Shows critical metrics: error rates, request counts, route details
- ✅ Clickable links to Vercel project, team, and observability dashboard
- ✅ Color-coded alerts:
- 🟡 Yellow for anomalies and warnings
- 🔴 Red for errors and failures
- 🔵 Blue for general alerts
- ✅ Statistical information (Z-scores, averages, standard deviation)
- ✅ Complete raw payload for debugging
For error anomaly alerts, the webhook shows:
- Project and Team: With clickable links to Vercel dashboard
- Error Details: Route, status group (5xx, 4xx, etc.), error rates
- Metrics: Current vs average error rates, change amounts
- Statistics: Z-scores, averages, standard deviations
- Timing: When the alert started (formatted as Discord timestamp)
- Direct Links: To Vercel observability dashboard for detailed analysis
observability.anomaly-error- Error rate anomalies (5xx, 4xx status codes)usage_anomaly- Unusual usage patterns- And other Vercel alert types
The webhook creates rich Discord embeds with:
- Alert title showing the specific issue and project name
- Detailed description with error rates and metrics
- Organized fields showing project info, routes, and statistics
- Direct links to Vercel dashboards for immediate investigation
- Complete raw payload for debugging purposes