Cloudflare Worker that receives Sentry alert webhooks and forwards them to Slack or Discord, routed per Sentry project.
Sentry's Developer plan has no Slack or Discord integration, but Internal Integration webhooks are available on every plan. One integration fans out to every project, so this Worker maps data.event.project to a destination webhook held in KV, falling back to FALLBACK_DESTINATION_URL when a project has no mapping.
src/sentry.ts— webhook receiver: signature check, routing, deliverysrc/admin.ts— mapping create/delete behindAuthorization: Bearer $ADMIN_TOKENsrc/formatters/— Slack Block Kit and Discord embed payloads
The contract is specified by the tests rather than by this file: pnpm test.
The button clones this repository, provisions the PROJECTS KV namespace, and prompts for the secrets listed in .dev.vars.example. Two steps stay manual afterwards:
- Create a Sentry internal integration with its webhook URL set to
https://<worker>/sentry, and set the integration's client secret asSENTRY_CLIENT_SECRET. - Add a mapping for each Sentry project you want routed — see Operations.
pnpm exec wrangler secret list
pnpm exec wrangler kv key list --binding PROJECTS --remote
pnpm deployprojectId is Sentry's internal numeric project ID — the value of data.event.project, also visible in the routing unknown project to fallback log line.
curl -X POST https://<worker>/admin/projects \
-H "authorization: Bearer $ADMIN_TOKEN" \
-H "content-type: application/json" \
-d '{"projectId":"1234567","destinationUrl":"https://hooks.slack.com/services/..."}'There is no update endpoint. To change a destination, DELETE then POST.
pnpm dev # reads secrets from .dev.vars, see .dev.vars.example
pnpm test
pnpm typecheck
pnpm check/admin/*is a single static bearer token with no rate limiting. An unsetADMIN_TOKENrejects every request rather than allowing them.- Preview URLs are public by default and share the Worker's bindings, so every deployed version exposes the same endpoints.
ISC. See LICENSE.