# Building Your First Workflow

This guide walks you through creating a simple workflow that emails a lead after they submit a webform, waits a day, and then has a Voice agent call them. By the end, you'll understand how triggers, steps, and settings work together.

For a full feature reference, see the [Workflows](/agents/workflows.md) page.

## Before You Start

Make sure you have:

* At least one agent configured (Chat, Email, or Voice)
* An email template in mind for the first outreach
* A Voice agent set up if you want to include a Call Phone step

{% stepper %}
{% step %}

#### Create a new workflow

Navigate to **Workflows** in the left sidebar and click **New workflow**. Give it a descriptive name like "Webform Follow-up."
{% endstep %}

{% step %}

#### Configure the trigger

Click the **Triggers** step at the top of the canvas. This defines which leads enter the workflow.

Add a criteria row:

* Field: **Webform submitted**
* Operator: **is true**

This means any lead who submits a webform will enter the workflow. You can add more criteria with the **+ Add criteria** button — for example, requiring that the lead also has an email address.

Click **+ Add condition group** to create OR logic between groups of criteria.
{% endstep %}

{% step %}

#### Add a Send Email step

Click the **+** button below the trigger to add a step. Choose **Send Email**.

In the configuration panel:

* Set **To** to "Lead"
* Write a subject line using variables: `Following up on your interest, {{ first_name }}`
* Write the email body. Use the ⚡ button to insert variables like company name or the page they visited.

See the [How to Use Spara's Text Editor](/guides/platform-guides/how-to-use-sparas-text-editor.md) for details on inserting variables.
{% endstep %}

{% step %}

#### Add a Wait step

Click **+** below the Send Email step and choose **Wait**. Set the duration to **1 Day**. This gives the lead time to read the email before the next step.
{% endstep %}

{% step %}

#### Add a Call Phone step

Click **+** below the Wait step and choose **Call Phone**. Select your Voice agent and outgoing phone number. The agent will call the lead and follow its own instructions.

{% hint style="warning" %}
If a lead doesn't have a phone number, this step is skipped automatically.
{% endhint %}
{% endstep %}

{% step %}

#### Review workflow settings

Click the **Settings** tab at the top. By default, Spara exits leads from the workflow when they reply to an email, respond to a text, or answer a call. This is usually what you want — it prevents leads from receiving follow-ups after they've already engaged.
{% endstep %}

{% step %}

#### Save and publish

Click **Save draft** to save your work. When you're ready to go live, click **Publish**. Spara will flag any configuration errors that need fixing.

Leads matching your trigger criteria will start entering the workflow immediately after publishing.
{% endstep %}
{% endstepper %}

## What's Next

* Add a [Condition Step](/agents/workflows/condition.md) step to branch logic based on lead data (e.g., different paths for enterprise vs. SMB)
* Use a [Prompt Step](/agents/workflows/prompt.md) step to research the lead's company and personalize downstream emails
* Add a [Notify Step](/agents/workflows/notify.md) step to alert your sales team in Slack when a lead progresses


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spara.com/guides/platform-guides/building-your-first-workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
