Use this flow when you’ve already authored a campaign in the Spotzee UI (audience, template, send-time settings) and want to fire it on demand from your code — for example, the morning of a product launch or in response to a webhook from another system.Documentation Index
Fetch the complete documentation index at: https://docs.spotzee.com/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll build
A backend call that:- Looks up an existing campaign by ID.
- Triggers a send with one or more contacts as the recipient set.
- Captures the response so you can correlate the send with downstream delivery events.
Prerequisites
You’ll need a
sk_ project key. The campaign must already exist in Spotzee — the API triggers existing campaigns rather than authoring new ones from scratch.Walkthrough
Find the campaign ID
GET /campaigns?limit=100 returns every campaign in the project with its id. In production, store the IDs you need in your config rather than looking them up on every send.A campaign in state: "draft" cannot be triggered. Promote it via the UI, or PATCH /campaigns/{id} to set state: "scheduled".Decide on the recipient set
Two shapes are supported:
The per-call form passes a
| Shape | Use when |
|---|---|
| Audience already on the campaign | The campaign is already targeted at a list or segment — just trigger it |
| Per-call recipients | You want to fire the same template at a one-off list of contacts (for example, a transactional broadcast keyed on a user action) |
users array. Each entry can be { external_id }, { anonymous_id }, or { email }. Custom attributes available to the template can ride alongside.Trigger the send
Track delivery downstream
Once enqueued, a campaign send progresses through the standard delivery lifecycle. Configure a webhook endpoint to receive
message.sent, message.delivered, message.bounced, and message.opened events tied back to the campaign and recipient.Pitfalls to avoid
- Don’t trigger the same campaign twice in a row. Spotzee will happily send twice — that’s what the API is for. Use an
Idempotency-Keyso a network retry doesn’t double-send. See Idempotency. - Don’t expect templates to render with arbitrary data. Template variables resolve against the contact + the per-call attributes you passed. Anything not in either shows up as blank.
- Don’t trigger campaigns in a tight loop. A single trigger can target thousands of recipients; reach for the per-call audience approach rather than calling trigger N times.
Reference
- API surface — see Main API → Campaigns
- Receive delivery events — see Webhooks
- Safe retries — see Idempotency
- Per-event automation instead — see Trigger a journey