Automations & Broadcasts
Relevant source files
The following files were used as context for generating this wiki page:
Automations and Broadcasts enable the Resend .NET SDK to manage complex email workflows and scheduled group messaging. Automations define directed graphs of execution steps triggered by specific events, while Broadcasts handle mass delivery to specific segments or audiences. Sources: src/Resend/IResend.cs, src/Resend/Automation.cs
Automations
Automations manage event-driven workflows composed of multiple steps and connections. You define an automation as a graph where nodes are "Steps" (e.g., triggers, delays, or email actions) and edges are "Connections" defining the flow of execution. Sources: src/Resend/Automation.cs:11-48, src/Resend/AutomationStepData.cs:11-30
Automation Structure
The Automation resource contains the metadata and the full execution graph. Sources: src/Resend/Automation.cs:11-48
| Field | Type | Description |
|---|---|---|
Id | Guid | Unique identifier for the automation. |
Name | string | Display name of the automation series. |
Status | string | Current state, either enabled or disabled. |
Steps | List<AutomationStep> | Ordered list of execution steps. |
Connections | List<AutomationEdge> | Directed edges connecting steps in the graph. |
Sources: src/Resend/Automation.cs:18-47, src/Resend/AutomationSummary.cs:13-25
Step and Connection Logic
Every automation must include at least one trigger step. Steps use a Type discriminator (e.g., trigger, send_email, delay) and a Config property containing type-specific JSON data. Connections reference steps via a unique Key string. Sources: src/Resend/AutomationCreateData.cs:25-30, src/Resend/AutomationStepData.cs:16-29, tools/Resend.ApiServer/Controllers/AutomationController.cs:64-80
The following diagram illustrates the relationship between a trigger event and subsequent email actions in a standard automation flow.
Automation Management API
The IResend interface provides methods to create, retrieve, update, duplicate, and stop automations. Sources: src/Resend/IResend.cs:1160-1230
- Create: POST to
/automationswithAutomationCreateData. - Update: PATCH to
/automations/{id}to modify status, name, or graph structure. - Stop: POST to
/automations/{id}/stopto disable a running automation. - Duplicate: POST to
/automations/{id}/duplicateto create a new instance of an existing graph.
Sources: src/Resend/ResendClient.Automations.cs:10-75, tools/Resend.ApiServer/Controllers/AutomationController.cs:25-140
Execution Monitoring (Runs)
An "Automation Run" represents a single execution instance of an automation graph triggered for a specific user or event. Sources: src/Resend/AutomationRun.cs:10-48
Run Details and Status
Runs track the start and completion moments for both the overall run and individual steps within that run. Sources: src/Resend/AutomationRun.cs:29-47, src/Resend/AutomationRunSummary.cs:13-39
| Property | Description |
|---|---|
Status | Current state of the run (e.g., running, completed). |
MomentStarted | Timestamp when the run began execution. |
MomentCompleted | Timestamp when the final step finished. |
Steps | List of AutomationRunStep objects containing output or error data. |
Sources: src/Resend/AutomationRun.cs:23-47, tools/Resend.ApiServer/Controllers/AutomationController.cs:200-224
Broadcasts
Broadcasts represent one-time email campaigns sent to a defined SegmentId. Sources: src/Resend/IResend.cs:640-750
Broadcast Operations
You manage broadcasts through several lifecycle methods in the IResend interface. Sources: src/Resend/IResend.cs:640-750
- Add: Create a draft broadcast with
BroadcastData(Subject, From, SegmentId, Body). - Send: Dispatch the broadcast immediately.
- Schedule: Set a future
DateTimefor automated dispatch. - Cancel: Abort a scheduled or queued broadcast.
- Recipients: Retrieve a paginated list of recipients filtered by event types (Delivered, Opened, Clicked, Bounced).
Sources: src/Resend/IResend.cs:648-735, tests/Resend.Tests/ResendClientTests.cs:510-650
Interaction Tracking
Broadcasts provide detailed engagement metrics, specifically for link tracking. The API allows listing every link clicked within a broadcast, including total and unique click counts. Sources: src/Resend/IResend.cs:740-748, tests/Resend.Tests/ResendClientTests.cs:660-685
Summary
Automations provide a stateful, graph-based workflow engine for event-driven communications, while Broadcasts facilitate large-scale, segment-targeted email campaigns with integrated engagement tracking. Both systems utilize the core Resend infrastructure for reliable delivery and detailed execution logging. Sources: src/Resend/IResend.cs:640-750, 1160-1230