Skip to main content
Workflows are currently in private alpha and only available to a limited number of users. APIs might change before GA.To use the methods on this page, you must upgrade your Resend SDK:
npm install resend@6.10.0-preview-workflows.0
Contact us if you’re interested in testing this feature.
Workflows allow you to automate email sending based on custom events from your application. You can use Workflows for automations like:
  • Welcome emails (e.g. user.created)
  • Feature adoption (e.g. invite.sent)
  • Payment recovery (e.g. payment.failed)
  • Abandoned cart (e.g. cart.abandoned)
  • Trial expiration (e.g. trial.ended)
  • And more

Getting started

To start executing a Workflow, you need to:
1

Create Workflow

First, you need to build the sequence of steps that will be executed.
2

Add Trigger

Then, you need to define the event name that will trigger the Workflow.
3

Define Actions

Then, you need to define the actions that will be executed.
4

Send an Event

Finally, you need to send the event to trigger the Workflow.

1. Create Workflow

The Workflows page shows all existing workflows.Click Create workflow to start a new Workflow.Create Workflow

2. Add Trigger

A trigger is the first step that will run when the Workflow is executed. Add Trigger to Workflow On this example, we will receive an event called user.created as a trigger. Add Event Received Trigger

3. Define Actions

Now, we need to define the actions that will be executed. On this example, we will use the Send email action. But you could also add a Time delay or True/false branch action. Define Actions Once you select the Send email action, you will be able to select an existing template.
Note: Only published templates are available to be used in a Workflow.
Add Send Email Action With the template selected, you will be able to configure the email subject and sender address. Send Email Action Settings Once you’re done with the email, you can click on Start workflow to enable the Workflow. Workflow Enabled

4. Send an Event

Now, we’re ready to send an event to trigger the Workflow. On your application, you can send an event to trigger the Workflow by using the API.
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

// Trigger with a contact ID
const { data, error } = await resend.events.send({
  event: 'user.created',
  contactId: '7f2e4a3b-dfbc-4e9a-8b2c-5f3a1d6e7c8b',
  payload: {
    plan: 'pro',
  },
});

// Trigger with an email address
const { data, error } = await resend.events.send({
  event: 'user.created',
  email: 'steve.wozniak@gmail.com',
  payload: {
    plan: 'pro',
  },
});
View the API reference for more details.