Receive, validate, and process webhooks from external services. Events are published to a Pub/Sub topic and processed by multiple subscribers independently (fan-out pattern).
Explore and test endpoints in the Local Dashboard when running locally. When deployed to Encore Cloud, use the Service Catalog to call endpoints and view traces to see how requests flow between services.
Optionally set webhook secrets for signature validation:
encore secret set --type dev,local,pr,prod WebhookSecretStripe
encore secret set --type dev,local,pr,prod WebhookSecretGitHub
The Postgres database is provisioned automatically when you run encore run. No manual database setup required.
When secrets are configured, incoming webhooks are verified using the official SDKs:
Stripe — Uses the Stripe Node SDK (stripe.webhooks.constructEvent) to verify the Stripe-Signature header. Stripe signs payloads using a timestamp and HMAC-SHA256 signature in the format t=...,v1=....
GitHub — Uses HMAC-SHA256 with crypto.timingSafeEqual to verify the X-Hub-Signature-256 header. GitHub signs payloads with HMAC-SHA256, prefixed with sha256=.
Without secrets configured, all webhooks are accepted without signature checks.
Three services demonstrate the fan-out pattern:
ingest receives webhooks and publishes to a Pub/Sub topic. processor and notifications both subscribe independently, so each event is handled by both services in parallel.
ingest.receive
Receive a webhook. Validates signature if configured, then queues for processing.
curl -X POST https://staging-webhook-processor-nu62.encr.app/webhooks/stripe \
-H "Content-Type: application/json" \
-d '{"type": "payment_intent.succeeded", "data": {"object": {"amount": 2000}}}'
# GitHub webhook example
curl -X POST https://staging-webhook-processor-nu62.encr.app/webhooks/github \
-H "Content-Type: application/json" \
-H "X-GitHub-Event: push" \
-d '{"ref": "refs/heads/main"}'