# Code workflows with Trigger.dev, Windmill and Kestra

Code workflows with Trigger.dev, Windmill and Kestra: typed blueprints for running SendBeam from a task, TypeScript and Python scripts, or a 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](https://sendbeam.io/docs/integrations/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](https://sendbeam.io/docs/integrations/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](https://sendbeam.io/docs/integrations/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/contacts` and 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-Signature` is `t=,v1=`; check it against the raw bytes, refuse anything older than five minutes, and use `X-SendBeam-Delivery` as the idempotency key.
- **Marketing consent is yours to hold.** Add someone to a marketing list only if they agreed; site email through `/api/v1/transactional` needs 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](https://sendbeam.io/docs/api); the event payloads and the signature are under [Webhooks](https://sendbeam.io/docs/api/webhooks).

---
Source: https://sendbeam.io/docs/integrations/code-workflows
