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: {
template: { id: '34a080c9-b17d-4187-ad80-5af20266e535' },
},
},
],
connections: [{ 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: {
template: { id: '34a080c9-b17d-4187-ad80-5af20266e535' },
},
},
],
connections: [{ from: 'start', to: 'welcome' }],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
npm install resend@6.11.0-canary.1
enabled or disabled.
Defaults to disabled.connections. See Step
Properties for full object
definition.steps. See Connection
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: {
template: { id: '34a080c9-b17d-4187-ad80-5af20266e535' },
},
},
],
connections: [{ from: 'start', to: 'welcome' }],
});
{
"object": "automation",
"id": "c9b16d4f-ba6c-4e2e-b044-6bf4404e57fd"
}
Was this page helpful?