> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brew.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an Automation

> Create, test, and publish event-triggered email flows in Brew before they reach real contacts when you need reliable lifecycle email.

Use this guide to create an event-triggered flow, connect a custom event, and test the path before launch. For a concrete welcome sequence, follow the [Build a Welcome Flow](/recipes/build-a-welcome-flow) recipe.

Prefer to watch first? The seven minute walkthrough covers the same ground. Each **Watch this step** link below opens it in a new tab at the matching moment.

<iframe src="https://www.loom.com/embed/8a4333b8b40e40ac99ad4626c5fdb7ae" loading="lazy" title="Set Up Powerful Email Automations" className="w-full aspect-video rounded-xl" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

<Info>
  **Before you start.** Add a brand and verify a sending domain. If your backend will fire a custom event, create an API key for the active brand. [Watch this step (0:42)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=39)
</Info>

## Create the Flow

<Steps>
  <Step title="Describe the flow">
    Open **Home** and describe the trigger, emails, timing, and outcome. For example:

    > *"Build a two-step onboarding flow for new trial users. Trigger it when `user_signup` fires. Send a welcome email, wait 3 days, then send a quick-start email."*

    [Watch this step (1:51)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=108)
  </Step>

  <Step title="Review the canvas">
    Brew opens the flow canvas with the trigger, **Send Email** nodes, and **Wait** nodes laid out from left to right. Click a node to open its configuration panel.

    [Watch this step (4:50)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=287)
  </Step>

  <Step title="Edit the flow">
    Prompt changes in the flow chat, or edit a node directly. For example, ask *"Change the wait to 4 days"* or *"Add a branch after the second email for contacts who clicked."*

    [Watch this step (5:25)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=322)
  </Step>

  <Step title="Save the draft">
    New flows start as **Draft**. Keep the flow in Draft while you configure and test its trigger. You will publish it after the test passes.
  </Step>
</Steps>

<Note>
  Each flow run consumes credits. Email sends inside the flow count toward your monthly send limit.
</Note>

## Create a Custom Trigger Event

<Steps>
  <Step title="Create the event">
    Open **Trigger events** from the trigger panel settings link or press **Cmd+K** and search for *Trigger events*. Click **Create event** and use a specific name such as `user_signup`, `order_placed`, or `subscription_renewed`.
  </Step>

  <Step title="Define the payload schema">
    Add each field the event will send and mark required fields. Keep the payload flat so it is easy to use in email templates. Include a required email field for routing:

    ```json theme={null}
    {
      "email": "alex@example.com",
      "firstName": "Alex",
      "orderId": "ORD-12345",
      "plan": "pro"
    }
    ```
  </Step>

  <Step title="Fire the event from your backend">
    Send the event to Brew with an API key for the active brand. The API endpoint is `POST /v1/automations/triggers/{triggerEventId}/fire`. See the [API Reference](/api-reference/api/api-introduction) for the request contract.
  </Step>

  <Step title="Use the event in a flow">
    Select the event as an automation trigger. Brew adds its schema to the trigger node, so email content can reference fields with `{{ fieldName }}`.

    [Watch this step (2:41)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=158)
  </Step>

  <Step title="Test before launch">
    Open the flow and click **Test automation**. Enter a test email address and provide the trigger payload, then click **Fire test**.

    Brew runs the full flow and sends every email to the test address only. Real contacts in the payload are never reached, and test runs do not affect analytics.
  </Step>

  <Step title="Publish and monitor">
    When the test looks right, click **Publish** in the canvas header to make the flow **Live**. The next matching event starts it automatically. Open the automation from the list to review execution history and failures.

    [Watch this step (6:02)](https://www.loom.com/share/8a4333b8b40e40ac99ad4626c5fdb7ae?t=359)
  </Step>
</Steps>

## Keep Event Schemas Maintainable

* Use descriptive event names such as `user_signup` or `order_placed`, not `event1`.
* Keep payloads flat and include only fields the automation uses.
* Mark field types in the schema. Brew rejects invalid values before they trigger an automation.

<Note>
  If a payload is missing a required field or uses the wrong type, Brew returns `400 INVALID_PAYLOAD` and does not start the automation. See the [error response shape](/create-emails/automations#what-happens-when-a-payload-fails-validation). Fix the payload and send it again.
</Note>

## 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:

<Tabs>
  <Tab title="Self-Service Tools">
    <CardGroup cols="2">
      <Card title="Search Documentation" icon="magnifying-glass" color="#c44925">
        Type in the "Ask any question" search bar at the top left to instantly find relevant documentation pages.
      </Card>

      <Card title="ChatGPT/Claude Integration" icon="robot" color="#c44925">
        Click "Open in ChatGPT" at the top right of any page to explore it further with ChatGPT or Claude.
      </Card>
    </CardGroup>
  </Tab>

  <Tab title="Talk to Our Team">
    <CardGroup cols="2">
      <Card title="Schedule a Call" icon="calendar" color="#c44925" href="https://calendar.google.com/calendar/u/0/appointments/schedules/AcZssZ1iYoRUG1J792XQpbuQLjSRRDupr7MwraFK-HQRCtTYdBmrQi8nZu2qXfzKQigb8gbKJK3KN3-R">
        Book time with our founders for personalized guidance on strategy, best practices, or complex implementation questions.
      </Card>

      <Card title="Call Us Directly" icon="phone" color="#c44925">
        Need immediate assistance? Reach us at **+1-(332)-203-2145** for urgent issues or time-sensitive questions.
      </Card>

      <Card title="Slack Channel" icon="slack" color="#c44925">
        Our preferred support channel. You'll receive an invite after signup for direct founder support and fast responses.
      </Card>

      <Card title="Email Support" icon="envelope" color="#c44925" href="mailto:support@brew.new">
        Contact us at **[support@brew.new](mailto:support@brew.new)** for detailed inquiries or if you prefer not to use Slack.
      </Card>
    </CardGroup>
  </Tab>
</Tabs>
