- Plan-based emails: Send different content to free vs. paid users.
- Engagement splits: Take different actions based on user activity.
- Personalization: Tailor follow-ups based on event payload values.
How it works
- Using the dashboard
- Using the API
Add a Condition step and configure the condition using the editor.

The condition step accepts a
type and the corresponding rule fields.import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.automations.create({
name: 'Plan-based Welcome',
steps: [
{
key: 'start',
type: 'trigger',
config: { eventName: 'user.created' },
},
{
key: 'check_plan',
type: 'condition',
config: {
type: 'rule',
field: 'event.plan',
operator: 'eq',
value: 'pro',
},
},
{
key: 'send_pro_email',
type: 'send_email',
config: { template: { id: 'pro-welcome-template-id' } },
},
{
key: 'send_free_email',
type: 'send_email',
config: { template: { id: 'free-welcome-template-id' } },
},
],
connections: [
{ from: 'start', to: 'check_plan', type: 'default' },
{ from: 'check_plan', to: 'send_pro_email', type: 'condition_met' },
{
from: 'check_plan',
to: 'send_free_email',
type: 'condition_not_met',
},
],
});
$resend = Resend::client('re_xxxxxxxxx');
$resend->automations->create([
'name' => 'Plan-based Welcome',
'steps' => [
[
'key' => 'start',
'type' => 'trigger',
'config' => ['event_name' => 'user.created'],
],
[
'key' => 'check_plan',
'type' => 'condition',
'config' => [
'type' => 'rule',
'field' => 'event.plan',
'operator' => 'eq',
'value' => 'pro',
],
],
[
'key' => 'send_pro_email',
'type' => 'send_email',
'config' => ['template' => ['id' => 'pro-welcome-template-id']],
],
[
'key' => 'send_free_email',
'type' => 'send_email',
'config' => ['template' => ['id' => 'free-welcome-template-id']],
],
],
'connections' => [
['from' => 'start', 'to' => 'check_plan', 'type' => 'default'],
['from' => 'check_plan', 'to' => 'send_pro_email', 'type' => 'condition_met'],
['from' => 'check_plan', 'to' => 'send_free_email', 'type' => 'condition_not_met'],
],
]);
import resend
resend.api_key = "re_xxxxxxxxx"
params: resend.Automations.CreateParams = {
"name": "Plan-based Welcome",
"steps": [
{
"key": "start",
"type": "trigger",
"config": {"event_name": "user.created"},
},
{
"key": "check_plan",
"type": "condition",
"config": {
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro",
},
},
{
"key": "send_pro_email",
"type": "send_email",
"config": {"template": {"id": "pro-welcome-template-id"}},
},
{
"key": "send_free_email",
"type": "send_email",
"config": {"template": {"id": "free-welcome-template-id"}},
},
],
"connections": [
{"from": "start", "to": "check_plan", "type": "default"},
{"from": "check_plan", "to": "send_pro_email", "type": "condition_met"},
{"from": "check_plan", "to": "send_free_email", "type": "condition_not_met"},
],
}
resend.Automations.create(params)
require "resend"
Resend.api_key = "re_xxxxxxxxx"
params = {
name: "Plan-based Welcome",
steps: [
{
key: "start",
type: "trigger",
config: { event_name: "user.created" },
},
{
key: "check_plan",
type: "condition",
config: {
type: "rule",
field: "event.plan",
operator: "eq",
value: "pro",
},
},
{
key: "send_pro_email",
type: "send_email",
config: { template: { id: "pro-welcome-template-id" } },
},
{
key: "send_free_email",
type: "send_email",
config: { template: { id: "free-welcome-template-id" } },
},
],
connections: [
{ from: "start", to: "check_plan", type: "default" },
{ from: "check_plan", to: "send_pro_email", type: "condition_met" },
{ from: "check_plan", to: "send_free_email", type: "condition_not_met" },
],
}
Resend::Automations.create(params)
package main
import "github.com/resend/resend-go/v3"
func main() {
client := resend.NewClient("re_xxxxxxxxx")
params := &resend.CreateAutomationRequest{
Name: "Plan-based Welcome",
Steps: []resend.AutomationStep{
{
Key: "start",
Type: resend.AutomationStepTypeTrigger,
Config: map[string]any{
"event_name": "user.created",
},
},
{
Key: "check_plan",
Type: resend.AutomationStepTypeCondition,
Config: map[string]any{
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro",
},
},
{
Key: "send_pro_email",
Type: resend.AutomationStepTypeSendEmail,
Config: map[string]any{
"template": map[string]any{"id": "pro-welcome-template-id"},
},
},
{
Key: "send_free_email",
Type: resend.AutomationStepTypeSendEmail,
Config: map[string]any{
"template": map[string]any{"id": "free-welcome-template-id"},
},
},
},
Connections: []resend.AutomationConnection{
{From: "start", To: "check_plan", Type: resend.AutomationConnectionTypeDefault},
{From: "check_plan", To: "send_pro_email", Type: resend.AutomationConnectionTypeConditionMet},
{From: "check_plan", To: "send_free_email", Type: resend.AutomationConnectionTypeConditionNotMet},
},
}
client.Automations.Create(params)
}
use resend_rs::{
json,
types::{
AutomationStatus, AutomationTemplate, Connection, ConnectionType, CreateAutomationOptions,
SendEmailStepConfig, Step, TriggerStepConfig,
},
Resend, Result,
};
#[tokio::main]
async fn main() -> Result<()> {
let resend = Resend::new("re_xxxxxxxxx");
let opts = CreateAutomationOptions {
name: "Plan-based Welcome".to_owned(),
steps: vec![
Step::Trigger {
key: "start".to_owned(),
config: TriggerStepConfig {
event_name: "user.created".to_owned(),
},
},
Step::Condition {
key: "check_plan".to_owned(),
config: json!({
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro",
}),
},
Step::SendEmail {
key: "send_pro_email".to_owned(),
config: SendEmailStepConfig::new(AutomationTemplate::new("pro-welcome-template-id")),
},
Step::SendEmail {
key: "send_free_email".to_owned(),
config: SendEmailStepConfig::new(AutomationTemplate::new("free-welcome-template-id")),
},
],
connections: vec![
Connection::new("start", "check_plan").with_type(ConnectionType::Default),
Connection::new("check_plan", "send_pro_email").with_type(ConnectionType::ConditionMet),
Connection::new("check_plan", "send_free_email").with_type(ConnectionType::ConditionNotMet),
],
status: AutomationStatus::Disabled,
};
let _automation = resend.automations.create(opts).await?;
Ok(())
}
import com.resend.*;
public class Main {
public static void main(String[] args) {
Resend resend = new Resend("re_xxxxxxxxx");
CreateAutomationOptions options = CreateAutomationOptions.builder()
.name("Plan-based Welcome")
.steps(
AutomationStep.trigger("start")
.eventName("user.created")
.build(),
AutomationStep.condition("check_plan")
.rule(ConditionRule.builder()
.field("event.plan")
.operator(ConditionOperator.EQ)
.value("pro")
.build())
.build(),
AutomationStep.sendEmail("send_pro_email")
.template("pro-welcome-template-id")
.build(),
AutomationStep.sendEmail("send_free_email")
.template("free-welcome-template-id")
.build()
)
.connections(
AutomationConnection.builder()
.from("start")
.to("check_plan")
.type(ConnectionType.DEFAULT)
.build(),
AutomationConnection.builder()
.from("check_plan")
.to("send_pro_email")
.type(ConnectionType.CONDITION_MET)
.build(),
AutomationConnection.builder()
.from("check_plan")
.to("send_free_email")
.type(ConnectionType.CONDITION_NOT_MET)
.build()
)
.build();
CreateAutomationResponseSuccess data = resend.automations().create(options);
}
}
using Resend;
using System.Text.Json;
IResend resend = ResendClient.Create( "re_xxxxxxxxx" );
var startConfig = JsonSerializer.SerializeToElement( new { event_name = "user.created" } );
var conditionConfig = JsonSerializer.SerializeToElement( new
{
type = "rule",
field = "event.plan",
@operator = "eq",
value = "pro",
} );
var proEmailConfig = JsonSerializer.SerializeToElement( new { template = new { id = "pro-welcome-template-id" } } );
var freeEmailConfig = JsonSerializer.SerializeToElement( new { template = new { id = "free-welcome-template-id" } } );
var resp = await resend.AutomationCreateAsync( new AutomationCreateData()
{
Name = "Plan-based Welcome",
Steps = new List<AutomationStepData>
{
new AutomationStepData { Ref = "start", Type = "trigger", Config = startConfig },
new AutomationStepData { Ref = "check_plan", Type = "condition", Config = conditionConfig },
new AutomationStepData { Ref = "send_pro_email", Type = "send_email", Config = proEmailConfig },
new AutomationStepData { Ref = "send_free_email", Type = "send_email", Config = freeEmailConfig },
},
Connections = new List<AutomationEdge>
{
new AutomationEdge { From = "start", To = "check_plan", EdgeType = "default" },
new AutomationEdge { From = "check_plan", To = "send_pro_email", EdgeType = "condition_met" },
new AutomationEdge { From = "check_plan", To = "send_free_email", EdgeType = "condition_not_met" },
},
} );
curl -X POST 'https://api.resend.com/automations' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"name": "Plan-based Welcome",
"steps": [{
"key": "start",
"type": "trigger",
"config": { "event_name": "user.created" }
}, {
"key": "check_plan",
"type": "condition",
"config": {
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro"
}
}, {
"key": "send_pro_email",
"type": "send_email",
"config": { "template": { "id": "pro-welcome-template-id" } }
}, {
"key": "send_free_email",
"type": "send_email",
"config": { "template": { "id": "free-welcome-template-id" } }
}],
"connections": [
{ "from": "start", "to": "check_plan", "type": "default" },
{ "from": "check_plan", "to": "send_pro_email", "type": "condition_met" },
{ "from": "check_plan", "to": "send_free_email", "type": "condition_not_met" }
]
}'
resend automations create --name "Plan-based Welcome" --file ./automation.json
Connection types
A condition step always produces two outgoing connections.| Connection type | Description |
|---|---|
condition_met | Taken when the condition evaluates to true |
condition_not_met | Taken when the condition evaluates to false |
{
"from": "check_plan",
"to": "send_pro_email",
"type": "condition_met"
},
{
"from": "check_plan",
"to": "send_free_email",
"type": "condition_not_met"
}
Configuration
The type of condition node. Possible values:
ruleandor
rule type:
The field to evaluate. Must use the
event. or contact. namespace prefix
(e.g., event.amount, contact.email).The comparison operator. Possible values:
eq: equalsneq: not equalsgt: greater thangte: greater than or equal tolt: less thanlte: less than or equal tocontains: contains a given valuestarts_with: starts with a given valueends_with: ends with a given valueexists: field existsis_empty: field is empty
The value to compare against. Not required for
exists and is_empty
operators.and / or types:
An array of nested condition config objects. Must contain at least one item.
{
"key": "check_plan",
"type": "condition",
"config": {
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro"
}
}
and or or to combine multiple rules into a single branch:
{
"key": "check_plan_and_amount",
"type": "condition",
"config": {
"type": "and",
"rules": [
{
"type": "rule",
"field": "event.plan",
"operator": "eq",
"value": "pro"
},
{
"type": "rule",
"field": "event.amount",
"operator": "gte",
"value": 100
}
]
}
}