Files
claude-status-webhook/wrangler.jsonc
tiennm99 b728ae7d38 refactor: per-subscriber KV keys, HMAC verification, cron trigger
Major refactor addressing scalability, security, and reliability:

- KV schema: single-key → per-subscriber keys (sub:{chatId}:{threadId})
  eliminates read-modify-write race conditions
- Component-specific subscriptions: /subscribe component <name>
- HMAC-SHA256 webhook verification with URL secret fallback
- Cron trigger (every 5 min) polls status.claude.com as safety net
- Shared telegram-api.js module (DRY fix)
- Error logging in all catch blocks
- Migration endpoint for existing subscribers
- Setup moved to standalone script (scripts/setup-bot.js)
- Removed setup HTTP route to reduce attack surface
2026-04-09 00:43:07 +07:00

35 lines
699 B
JSON

{
"name": "claude-status-webhook",
"main": "src/index.js",
"compatibility_date": "2024-12-01",
"kv_namespaces": [
{
"binding": "claude_status",
"id": "d026d63d84bf49268364deb27d3dc28a",
"remote": true
}
],
"queues": {
"producers": [
{
"binding": "claude-status",
"queue": "claude-status"
}
],
"consumers": [
{
"queue": "claude-status",
"max_batch_size": 30,
"max_retries": 3
}
]
},
"triggers": {
"crons": ["*/5 * * * *"]
}
// Secrets (set via `wrangler secret put`):
// BOT_TOKEN - Telegram bot token
// WEBHOOK_SECRET - Statuspage webhook URL secret
// STATUSPAGE_HMAC_KEY - HMAC key from Statuspage webhook settings (optional)
}