Skip to content

notifications

Fresh

Source: BIBLE.md (Phase 12 Phase 2, notifications 5 routes)

Discord webhooks plus 5 notification channels. Exports a notify() function used everywhere.

5 channels

ChannelPurpose
cookie-failuresCookie refresh failures
rank-changesRank moved more than threshold
campaign-completionCampaign finished
errorsCritical errors
health-alertsAccount health drops

Routes (5)

MethodRouteWhat
POST/notifications/sendSend one notification
GET/notifications/channelsList configured channels
PUT/notifications/channels/:nameUpdate channel webhook
GET/notifications/historyRecent notifications
POST/notifications/testSend test message

Example payload

bash
curl -X POST http://localhost:4700/notifications/send \
  -H "Content-Type: application/json" \
  -d '{
    "channel": "rank-changes",
    "title": "Rank improvement",
    "message": "junk removal dallas: 12 to 7",
    "level": "info"
  }'

Configuration

Each channel maps to a Discord webhook URL in .env:

DISCORD_WEBHOOK_COOKIE_FAILURES=https://discord.com/api/webhooks/...
DISCORD_WEBHOOK_RANK_CHANGES=https://discord.com/api/webhooks/...
DISCORD_WEBHOOK_CAMPAIGN_COMPLETION=https://discord.com/api/webhooks/...
DISCORD_WEBHOOK_ERRORS=https://discord.com/api/webhooks/...
DISCORD_WEBHOOK_HEALTH_ALERTS=https://discord.com/api/webhooks/...