Code workflows: Trigger.dev, Windmill and Kestra
Copy-pasteable, typed blueprints for running SendBeam from code-first workflow platforms: a Trigger.dev task, Windmill scripts in TypeScript and Python, and a Kestra YAML flow.
If you would rather write a background job than map nodes in a visual tool, SendBeam is a JSON API behind one header, and these three blueprints are the whole integration: a typed task, a script, a flow. Each adds a contact, optionally puts them on a list, sends a site email, and can be started by SendBeam's own webhooks.
The three blueprints
- Trigger.dev — a v3
task()in TypeScript with a typed payload and retries, plus a Next.js route that verifies SendBeam's signature and triggers a task for each event. - Windmill — the same job as a TypeScript script and as a Python script, with the key held as a Windmill resource, and signature verification for Windmill's script webhooks.
- Kestra — a declarative YAML flow of HTTP tasks with the key as a Kestra secret, and a webhook-triggered flow that routes on the event type.
What every blueprint does the same way
- The key lives in the platform's secret store, one per environment, never in source. A staging run must not write to your production list.
- 409 is success.
POST /api/v1/contactsand adding to a list answer 409 when the person is already there, so a retried run never fails on its own earlier work. - Retries are the platform's job. A 5xx or a 429 from SendBeam is left to the task runner's retry policy rather than caught and swallowed.
- Inbound events are verified.
X-SendBeam-Signatureist=<unix seconds>,v1=<hex HMAC-SHA256 of "t.body">; check it against the raw bytes, refuse anything older than five minutes, and useX-SendBeam-Deliveryas the idempotency key. - Marketing consent is yours to hold. Add someone to a marketing list only if they agreed; site email through
/api/v1/transactionalneeds no consent.
Which calls to use
| To | Call | Permission |
|---|---|---|
| Add or update a person | POST /api/v1/contacts | contacts:write |
| Put them on a list | POST /api/v1/lists/{id}/contacts | lists:write |
| Send a receipt, a reset, a reminder | POST /api/v1/transactional | transactional:send |
| Report an order, a cart or a refund | POST /api/v1/ecommerce/events | ecommerce:write |
| Be told when something happens | Settings → Webhooks | — |
The full reference, with every field and response, is under API reference; the event payloads and the signature are under Webhooks.