emails.generate() creates the email content.
Build a Welcome Automation
Start with a configured brand and a verified marketing domain. SetBREW_API_KEY to a brand key and BREW_DOMAIN_ID to the intended domain.
For an organization key, pin a brand first.
Test Before Publishing
Continue with the client and automation above. OmittestRecipient for a run that sends no mail.
testRecipient delivers test emails to that address.
Inspect testCoverage for paths the run did not visit; use scenario to simulate engagement or force split branches.
After reviewing the test, publish and check readiness:
Fire from Your Backend
Send the real event payload after publishing. Use one retry key per source event.automations.triggerInstances.get(fire.triggerInstanceId).
Read each started run with automations.runs.get(runId, { include: 'logs' }).
The retry key is a request option; Idempotency owns replay behavior.
Reuse a Saved Design
Search ready designs before generating another one:Send to an Audience
With a configuredbrew client, choose a ready design, a verified marketing domain, and an opted-in audience.
Replace the IDs below and send yourself a test before launching:
sendId for brew.sends.get(sendId).
pending_approval means an administrator must approve the send before delivery.
Monitor Email Sends owns statuses and delivery results.
Edit a Published Graph
Useautomations.patch({ automationId, nodes, connections }) to save graph edits as a draft.
Then publish that version with automations.publish({ automationId, automationVersionId }).
Graph edits and published cannot share one patch request. The existing live version continues until you publish the new one.
For manual-audience flows, use automations.run({ automationId, dryRun: true }) to preview,
then omit dryRun to launch. Keep the returned audienceRunId for audienceRuns.pause(), resume(), or cancel().
See Error Handling and the Error Catalog for recovery.
Need Help?
Our team is ready to support you at every step of your journey with Brew. Choose the option that works best for you:- Self-Service Tools
- Talk to Our Team
Search Documentation
Type in the “Ask any question” search bar at the top left to instantly find relevant documentation pages.
Ask ChatGPT or Claude
Click here to open the Copy page menu at the top of this page, then send the page to ChatGPT, Claude, or your editor.