Wraps Logo
Workflows Quickstart

Get Started with Workflows

Define automated email sequences as TypeScript and deploy them in minutes. No drag-and-drop builders, no YAML — just code.

What you'll build

  • An automated email sequence defined as TypeScript
  • Local validation to catch errors before deploying
  • A production workflow triggered by contact events or the SDK

Time: ~5 minutes

Prerequisites

Before you begin, make sure you have:

  • Email infrastructure deployed via wraps email init
  • A Wraps Platform account (sign up)
  • At least one email template pushed via wraps email templates push (workflows reference templates by slug)

1
Initialize Workflows

Scaffold the workflows directory with an example workflow and config:

GNU Bashterminal.sh
npx @wraps.dev/cli email workflows init

What gets created

  • wraps/workflows/ — directory for your workflow files
  • wraps/workflows/welcome.ts — example welcome sequence
  • wraps/wraps.config.ts — project config (created if missing)

2
Write a Workflow

Each workflow is a TypeScript file that exports a defineWorkflow call. Here is a welcome sequence that sends an email, waits a day, then branches based on whether the contact activated:

TypeScriptwraps/workflows/welcome.ts
import {  defineWorkflow,  sendEmail,  delay,  condition,  exit,} from '@wraps.dev/client';export default defineWorkflow({  name: 'Welcome Sequence',  trigger: {    type: 'contact_created',  },  steps: [    sendEmail('send-welcome', { template: 'welcome-email' }),    delay('wait-1-day', { days: 1 }),    condition('check-activated', {      field: 'contact.hasActivated',      operator: 'equals',      value: true,      branches: {        yes: [exit('already-active')],        no: [          sendEmail('send-tips', { template: 'getting-started-tips' }),        ],      },    }),  ],});

Key concepts

  • Trigger — what starts the workflow (e.g. contact_created, event, schedule)
  • Steps — sequential actions: sendEmail, delay, condition, waitForEvent, exit, and more
  • Template slugs — reference templates you have already pushed (e.g. welcome-email)
  • Step IDs — unique kebab-case identifiers for each step

3
Validate Locally

Run validation to catch errors before pushing. This checks for unique step IDs, valid template references, correct trigger configuration, and more:

GNU Bashterminal.sh
npx @wraps.dev/cli email workflows validate

To validate a specific workflow, pass the --workflow flag:

GNU Bashterminal.sh
npx @wraps.dev/cli email workflows validate --workflow welcome

4
Push to Production

Push your workflows to the Wraps Platform where they will be executed automatically when their triggers fire:

GNU Bashterminal.sh
npx @wraps.dev/cli email workflows push

Useful flags

  • --dry-run — preview changes without pushing
  • --draft — push as draft without enabling the workflow
  • --workflow welcome — push a specific workflow only

5
Trigger a Workflow

Workflows with contact_created triggers fire automatically when contacts are added. For event or api triggers, use the SDK:

TypeScripttrigger-workflow.ts
import { createPlatformClient } from '@wraps.dev/client';const client = createPlatformClient({  apiKey: process.env.WRAPS_API_KEY,});// Trigger a workflowawait client.POST('/v1/workflows/{workflowId}/trigger', {  params: { path: { workflowId: 'welcome-sequence' } },  body: {    contactEmail: 'user@example.com',    data: { firstName: 'Alex' },  },});

Next Steps

Building Workflows

Full guide covering all step helpers, trigger types, conditions, and advanced patterns.

Workflow Guide
Custom Events

Trigger workflows from your own application events like purchases, signups, or cart abandonment.

Custom Events Guide
Cross-Channel Orchestration

Use cascade steps to coordinate email and SMS in a single workflow.

Orchestration Guide
Templates as Code

Write the email templates your workflows reference as React components.

Template Guide

Need Help?

If you run into any issues, check our GitHub discussions or open an issue.

Get Help