# Workflows Quickstart

Source: https://wraps.dev/docs/quickstart/email/workflows

# Get Started with Workflows

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

Run this quickstart with your AI agent

Paste into Claude Code, Cursor, or any agent with shell access.

Copy promptView

Using Claude Code? Install the Wraps skills for deeper context:

npx add-skill wraps-team/skills

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](https://app.wraps.dev/auth?mode=signup&plan=starter))
-   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:

terminal.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:

wraps/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:

terminal.sh

```
npx @wraps.dev/cli email workflows validate
```

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

terminal.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:

terminal.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:

trigger-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](https://wraps.dev/docs/guides/workflows)

Custom Events

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

[Custom Events Guide](https://wraps.dev/docs/guides/custom-events)

Cross-Channel Orchestration

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

[Orchestration Guide](https://wraps.dev/docs/guides/orchestration)

Templates as Code

Write the email templates your workflows reference as React components.

[Template Guide](https://wraps.dev/docs/guides/templates)

### Need Help?

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

[Get Help](https://github.com/wraps-team/wraps/discussions)
