Creating your first workflow
Workflows help you automate message sequences (send + delays) without wiring up your own schedulers or state machines. In this guide, you’ll create a simple onboarding workflow: send a signup message immediately, then send a follow-up one or two days later.
What you’ll build
- Workflow key:
welcome-sequence - Step 1: send a “Welcome” message
- Step 2: wait 1 day
- Step 3: send a “Getting started” message
Prerequisites
- An audience member exists (see Audience Members).
- You have at least one template to send (see Templates).
1) Create the workflow in the Dashboard
- Go to Workflows and create a new workflow.
- Set the workflow key to
welcome-sequence(this is what your code will call). - Add the first step: Send → choose your “Welcome” template.
2) Add a delay step
Add a second step: Delay → choose a duration (for example “1 day”).
3) Add the follow-up send
Add a third step: Send → choose a “Getting started” or “Welcome guide” template.
If your templates use variables (like {{firstName}}), make sure the template expects keys you can provide from code or workflow context.
4) Publish the workflow
Workflows need an active/published version to run. Publish the workflow once you’re ready to test it.
5) Trigger the workflow from your backend
When a user signs up (or first logs in), trigger the workflow for that member:
@chimekit/node
import { ChimeKit } from "@chimekit/node";
const ck = new ChimeKit({ secretKey: process.env.CHIMEKIT_SECRET_KEY! });
await ck.workflow.run("welcome-sequence", {
externalUserId: "user_123",
context: {
firstName: "Ava",
dashboardUrl: "https://app.example.com",
},
});
That context object becomes variables your workflow templates can reference (for example {{firstName}}).
Debugging and iteration
- If the workflow run is created successfully, you’ll get back a
runId. - You can fetch run metadata via the SDK API reference endpoint:
GET /sdk/v1/workflows/runs/:runId(SDK API Reference)
- Keep early workflows small and deterministic. Once you trust the plumbing, add more steps and richer context.
Next steps
- Learn how variables flow through templates and workflows: Using variables.
- Send multi-channel messages (in-app + email): Messaging Channels.