Workflows Quickstart
Define automated email sequences as code and deploy them in minutes.
Define automated email sequences as TypeScript and deploy them in minutes. No drag-and-drop builders, no YAML — just code.
What you'll build
Time: ~5 minutes
Before you begin, make sure you have:
wraps email initwraps email templates push (workflows reference templates by slug)Scaffold the workflows directory with an example workflow and config:
npx @wraps.dev/cli email workflows initWhat gets created
wraps/workflows/ — directory for your workflow fileswraps/workflows/welcome.ts — example welcome sequencewraps/wraps.config.ts — project config (created if missing)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:
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
contact_created, event, schedule)sendEmail, delay, condition, waitForEvent, exit, and morewelcome-email)Run validation to catch errors before pushing. This checks for unique step IDs, valid template references, correct trigger configuration, and more:
npx @wraps.dev/cli email workflows validateTo validate a specific workflow, pass the --workflow flag:
npx @wraps.dev/cli email workflows validate --workflow welcomePush your workflows to the Wraps Platform where they will be executed automatically when their triggers fire:
npx @wraps.dev/cli email workflows pushUseful flags
--dry-run — preview changes without pushing--draft — push as draft without enabling the workflow--workflow welcome — push a specific workflow onlyWorkflows with contact_created triggers fire automatically when contacts are added. For event or api triggers, use the SDK:
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' }, },});Full guide covering all step helpers, trigger types, conditions, and advanced patterns.
Workflow GuideTrigger workflows from your own application events like purchases, signups, or cart abandonment.
Custom Events GuideUse cascade steps to coordinate email and SMS in a single workflow.
Orchestration GuideWrite the email templates your workflows reference as React components.
Template Guide