import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Welcome series',
status: 'disabled',
steps: [
{
ref: 'trigger',
type: 'trigger',
config: { eventName: 'user.created' },
},
],
edges: [],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
Create a new automation to automate email sequences.
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Welcome series',
status: 'disabled',
steps: [
{
ref: 'trigger',
type: 'trigger',
config: { eventName: 'user.created' },
},
],
edges: [],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
npm install resend@6.10.0-preview-workflows.3
enabled or disabled.
Defaults to disabled.Show step properties
trigger, send_email, delay,
wait_for_event, condition, contact_update, contact_delete,
add_to_segment.type.Show trigger configuration
Show send_email configuration
Show delay configuration
Show wait_for_event configuration
Show condition configuration
and/or) of rules.rule, and, or.rule type:event. namespace prefix (e.g.,
event.amount, event.plan).eq, neq, gt, gte, lt,
lte, contains, starts_with, ends_with, exists, is_empty.exists and is_empty
operators.and / or types:Show contact_update configuration
contact_update step updates a contact’s fields. Each field value can be either a hardcoded value or a dynamic variable reference using the { var: '...' } syntax.Variable references use dot-notation with one of these scopes:event.* — references a field from the triggering event payload (e.g., event.firstName).contact.* — references a field from the current contact (e.g., contact.last_name, contact.properties.company).Show contact_delete configuration
contact_delete step does not require any configuration fields. Pass an
empty object {} as the config.Show add_to_segment configuration
Show edge properties
ref of the source step. In retrieve
responses, an internal identifier for the source step. Retrieved steps
include only type and config (no id or ref).ref of the destination step. In
retrieve responses, an internal identifier for the destination step.
Retrieved steps include only type and config (no id or ref).import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Welcome series',
status: 'disabled',
steps: [
{
ref: 'trigger',
type: 'trigger',
config: { eventName: 'user.created' },
},
],
edges: [],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
Was this page helpful?