> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Build your first automation Canonical URL: https://posthog.com/docs/workflows/automations/first-automation > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.posthog.com` instead of `https://app.posthog.com` (app host for links). ## On this page - [Before you start](#before-you-start) - [Build the automation](#build-the-automation) - [What you learned](#what-you-learned) - [Next steps](#next-steps) In this tutorial, you build an onboarding automation that welcomes new signups, waits for their first upload, and nudges the people who don't upload. You learn how triggers, conversion goals, and **Wait until** steps work together, and how to test an automation without emailing anyone. ## Before you start - **Set up your domain**, or use the [test sender](https://posthog.com/docs/workflows/email/test-sender.md) for now. See [set up your domain](https://posthog.com/docs/workflows/domain.md). - **Capture events** for what people do, such as `signed_up` and `uploaded_file`, and identify people with their email. See [installation](https://posthog.com/docs/workflows/installation/quick-start.md#capture-events-from-your-app). ## Build the automation Pick how you want to learn. Both paths build the same automation. ## With your agent ### Connect your agent Run `npx @posthog/wizard mcp add` to connect the [PostHog MCP](https://posthog.com/docs/workflows/mcp.md) to Claude Code, Cursor, Codex, or another agent. Then copy this prompt into your agent: Guided tutorial promptwith the [PostHog MCP](https://posthog.com/docs/workflows/mcp.md)[building-workflows](https://posthog.com/docs/workflows/skills.md) “Walk me step by step through building a draft onboarding automation in PostHog: trigger on signed\_up (once ever), set conversion goal uploaded\_file with exit on goal, send a welcome email, wait up to 2 days for uploaded\_file, and nudge anyone who didn't upload. Before creating each part, explain why it matters and pause after saving the draft so we can mock-test the welcome email step and review the Wait until branch and goal exit together. Leave the automation as a draft, and do not enable it until I review.” Copy The agent explains each part before it builds it, and saves its work as a draft. Check what you see at each checkpoint before you tell it to continue. ### Checkpoint 1: The trigger and the goal **What the agent builds:** a trigger on `signed_up`, with a frequency of one time ever, so each person goes through the automation only once. A conversion goal on `uploaded_file`, with **Exit when conversion goal is met**. **Why it matters:** with exit on goal, a person who uploads a file leaves the automation at once. Nobody gets a nudge for something they already did. **What you should see:** the agent names the trigger event, the frequency, the goal event, and the exit condition, and asks you to confirm them. ### Checkpoint 2: The welcome email and the wait **What the agent builds:** a welcome email after the trigger, then a **Wait until** step for `uploaded_file`, with a max time of 2 days. The step has two paths: - **Event received** – the person uploaded a file. This path goes to the exit. - **No match within 2d** – the person didn't upload. This path sends the nudge email. **What you should see:** the agent saves the automation as a draft, and gives you a link to it. It pauses before it tests anything. ### Checkpoint 3: A mocked step test **What the agent does:** it runs a mocked test on one step at a time with a sample person, with real HTTP requests turned off. A single-step test verifies the welcome email (rendering, subject, and recipient) without sending anything. It does not simulate a later `uploaded_file` event or advance the two-day wait. **What you should see:** - The welcome email step succeeds for the test person, with no real email sent. - You confirm the **Wait until** edges (**Event received** to exit, **No match within 2d** to the nudge email) and the `uploaded_file` exit-on-goal setting on the draft canvas. ### Checkpoint 4: Review and publish Open the draft in [**Workflows**](https://app.posthog.com/workflows). Check the trigger, the goal, both emails, and both paths on the canvas. Read each email in the editor. **What you should see:** the automation is still a draft. When it looks right, click **Enable**. Your agent never turns it on for you. ## By hand ### 1\. Create the automation Go to [**Workflows**](https://app.posthog.com/workflows), and click **New workflow**. Click **Blank workflow**. It starts with a trigger and an exit. ![The Create a workflow window with Blank workflow and the templates](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_new_light_c8ce048323.png) ### 2\. Pick the trigger Click the **Trigger** step. Click **Add trigger event**, then change the event to `signed_up`. Under **Frequency**, pick **One time per period**, then change the period to **ever**. Each person goes through the automation only once. ![The trigger step with the signed_up event and a frequency of one time ever](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_trigger_light_47a61c3e1b.png) ### 3\. Set the goal Scroll down to **Conversion goal**. Under **Detect conversion from events**, click **Add event**, and change the event to `uploaded_file`. Under **Exit condition**, pick **Exit when conversion goal is met**. People leave the automation when they upload a file. ![The conversion goal with uploaded_file, and the exit condition set to exit when the goal is met](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_goal_light_9efa65cea0.png) ### 4\. Add the welcome email Click **+** below the trigger. In the step list, click **Email**. ![The step list open below the trigger, with Email at the top](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_add_step_light_ad41505254.png) ### 5\. Write the welcome email In the email step, pick a sender in **From**, and type a **Subject**. Click **Start blank** to open the [email editor](https://posthog.com/docs/workflows/email-editor.md). Write the email. Type `/` to add a block, such as a **Button**. Click **Done**. ![The email editor with a welcome email and a button](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_email_light_6b84dcd733.png) ### 6\. Wait for the first upload Click **+** below the welcome email, and click **Wait until**. Under **Events to wait for**, click **Add event**, and change the event to `uploaded_file`. Set **Max time to wait** to 2 **Day(s)**. The step now has two paths: **Event received** for people who upload, and **No match within 2d** for people who don't. ![The Wait until step with uploaded_file and a max time of 2 days, and its two paths on the canvas](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_wait_until_light_46cabf3728.png) ### 7\. Save the automation Click **Create as draft**. PostHog saves the automation, but it doesn't send anything yet. From now on, it saves your changes as you go. ### 8\. Nudge the people who didn't upload Click **+** on the **No match within 2d** path, and click **Email**. Type a subject, click **Start blank**, write a short tip about how to upload a file, and click **Done**. Leave the **Event received** path empty, so it goes to the exit. ![The nudge email on the No match within 2d path, with its preview in the panel](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_nudge_light_a39ccb7811.png) ### 9\. Test it Click the welcome email step, and open the **Test** tab. Pick a person, and leave **Make real HTTP requests** off. Click **Run test**. PostHog shows what the step does, and sends nothing. ![The Test tab with a successful test of the welcome email](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_test_light_9f021581ff.png) ### 10\. Turn it on Click **Enable**. The automation is now live, and everyone who signs up goes through it. ![The live automation on the canvas, from the trigger to the exit](https://res.cloudinary.com/dmukukwp6/image/upload/w_1600,c_limit,q_auto,f_auto/first_automation_enable_light_dc9d8deb36.png) ## What you learned - A trigger with a frequency of one time ever starts the automation once for each person. - A conversion goal with exit on goal stops messages to people who already did the thing you want. - A **Wait until** step splits people into two paths: those who act within the max time, and those who don't. - A test with real HTTP requests turned off shows what each step does, and sends nothing. ## Next steps - [Product data and messaging](https://posthog.com/docs/workflows/concepts/product-data-and-messaging.md) – why events make your messages better. - [Triggers](https://posthog.com/docs/workflows/automations/triggers.md) – every way to start an automation. - [Steps](https://posthog.com/docs/workflows/automations/steps.md) – every step you can add. - [Test and debug an automation](https://posthog.com/docs/workflows/automations/debug.md) – find out why a person took a path. - [Edit a live automation](https://posthog.com/docs/workflows/automations/editing-live.md) – change an automation after you enable it.