Automations & macros
Trigger proactive widget messages from visitor behavior, and run reusable action sequences from the inbox.
Automations let Relay act on what a visitor does on your site — greet someone who just finished onboarding, nudge a visitor who has been reading your pricing page, or POST to your backend when a key event fires. Macros are the same action sequences, run by an agent from the conversation composer instead of a trigger.
Both are built in Automations in the sidebar, using the same vertical flow builder: a trigger at the top, then actions that run top to bottom.
Minimum requirements
- Complete Setup
- Install the Chat widget
- For custom-event triggers, wire up
trackin the Relay SDK
Triggers
An automation starts from one of two triggers:
- Visitor is on a page — matches the visitor's current URL with a
contains,is, orstarts withrule. Add an optional time on page so it only fires after the visitor has stayed that many seconds; navigating away first cancels it. Single-page-app route changes are detected automatically. - Custom event — fires when your site calls
relay.track("your_event_name"). See Track custom events.
An automation fires at most once per visitor, ever. Returning visitors are never re-triggered, even across sessions on the same browser.
Actions
Chain any of these, in any order:
- Send widget message — delivers a proactive chat message from your AI agent identity. If the visitor has no conversation yet, Relay opens one; the message shows a preview and unread badge even while the widget is closed.
- Webhook POST — sends JSON to your endpoint (10 second timeout, no retry). With include context on, the payload carries the conversation and contact.
- Wait — pauses up to 300 seconds before the next action.
- Add label / Set priority / Assign — updates the visitor's conversation. Assign accepts a teammate or your AI agent.
A webhook payload looks like this:
{
"workflowId": "…",
"workflowName": "Onboarding welcome",
"kind": "automation",
"event": { "type": "custom_event", "eventName": "onboarding_completed" },
"firedAt": "2026-07-05T20:24:59.000Z",
"conversation": {
"id": "…",
"contactId": "…",
"status": "open",
"priority": null,
"labels": ["automated"]
},
"contact": { "id": "…", "name": "Jane Doe", "email": "[email protected]" }
}For page-visit triggers, event is { "type": "page_visit", "url": "…" }; for macros it is { "type": "manual" }. conversation and contact are null when include context is off or no conversation exists yet.
Macros
Create a workflow with the Macro kind and it appears behind the lightning-bolt button in the conversation composer. Running one executes its actions against the open conversation — the message is sent as the agent who ran it, and it delivers over whichever channel owns the conversation (widget, WhatsApp, or email).
Macros have no trigger and no once-per-visitor limit; agents can run them as often as needed.
Enable, test, iterate
Workflows are created disabled — flip the Enabled switch and save when ready. Saving applies immediately.
While testing, remember the once-per-visitor rule applies to you too: after an automation fires for your browser, use Clear run history in the workflow's Runs panel to let every visitor (including you) trigger it again. The Runs panel also shows each run's status, what triggered it, and any step errors.
The whole feature is gated by the Automations module in workspace settings; turning the module off stops all triggers without touching your workflows.