Skip to main content
A trigger is the first step in every Automation. It defines which event will start the Automation when received. When your application sends an event to Resend, every active Automation with a matching trigger will execute its workflow for that contact.

How it works

The trigger is the first node in the editor.Add Trigger to AutomationChoose an existing custom event or type a new event name.Add Custom Event
Event names cannot start with the resend: prefix, which is reserved for system events.

Identifying contacts

When sending an event to trigger an Automation, you must identify the contact using either a contact_id or an email address.
Use a contact ID when you already have the Contact stored:

Event payload

You can include a payload object with your event to pass data into the Automation. This data becomes available as variables in subsequent steps in the Automation using the event.* namespace.
In this example, you can use event.amount, event.currency, and event.retryDate in other automation conditions and steps, or in email templates. View the Send Event API reference for the full endpoint specification.

Avoid duplicate runs

If your application sends the same event twice, each request starts a new run, and the contact can get the same email twice. A duplicate can come from a job that retries after a timeout, a queue that redelivers a message, or a webhook that arrives twice. To prevent duplicate runs, send an Idempotency-Key header with the event. If Resend accepted a request with the same key, event name, and contact in the last 24 hours, it returns that response and starts no runs. A failed request isn’t stored, so you can retry it with the same key.
Build the key from the record behind the event, like an order ID. A random key per request catches only network retries of that request. If your application builds the request again, for example in a retried job, it creates a new key and the duplicate starts new runs. Keys are scoped to the event name and the contact (contact_id or email). You can reuse order/123 for order.shipped, or for another contact on the same order. Resend doesn’t compare the payload, so a retry with a changed payload still returns the first response. Resend compares the email and contact_id case-insensitively, so User@example.com and user@example.com are the same contact. The same contact sent once by contact_id and once by email counts as two requests, so identify the contact the same way when you retry. The response includes an Idempotent-Replayed header. It’s true when Resend returns the stored response of an earlier request, and false when it processes the request. Header names are case-insensitive, and the Node.js SDK returns them in lowercase.

Configuration

string
required
The name of the event that triggers the automation.