import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Welcome series',
status: 'disabled',
steps: [
{
key: 'start',
type: 'trigger',
config: { eventName: 'user.created' },
},
{
key: 'welcome',
type: 'send_email',
config: {
templateId: '34a080c9-b17d-4187-ad80-5af20266e535',
},
},
],
edges: [{ from: 'start', to: 'welcome' }],
});
{
"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: [
{
key: 'start',
type: 'trigger',
config: { eventName: 'user.created' },
},
{
key: 'welcome',
type: 'send_email',
config: {
templateId: '34a080c9-b17d-4187-ad80-5af20266e535',
},
},
],
edges: [{ from: 'start', to: 'welcome' }],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
npm install resend@6.10.0-preview-workflows.3
enabled or disabled.
Defaults to disabled.edges. See Step Properties
for full object definition.steps. See Edge
Properties for full object
definition.import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Welcome series',
status: 'disabled',
steps: [
{
key: 'start',
type: 'trigger',
config: { eventName: 'user.created' },
},
{
key: 'welcome',
type: 'send_email',
config: {
templateId: '34a080c9-b17d-4187-ad80-5af20266e535',
},
},
],
edges: [{ from: 'start', to: 'welcome' }],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
Was this page helpful?