Send an HTML Email Campaign with AI-Powered Reply Handling
Build a complete email campaign with personalized HTML emails and AI-powered reply handling.
Send an HTML Email Campaign with AI-Powered Reply Handling
What You'll Accomplish
By the end of this tutorial, you'll have a working email campaign that sends personalized HTML emails to a filtered group of members and automatically handles their replies using an AI-powered workflow. When a member replies to your campaign email, Gravity Rail receives the message, starts a conversation, and processes the reply according to your workflow's instructions — answering questions, collecting information, or escalating to your team.
What You'll Need
- A Gravity Rail workspace
- A dedicated inbox configured for the campaign (see Step 1)
- Members in your workspace with the labels or data fields you want to filter on
- An HTML email template (or the content you want to send)
- A reply-handling workflow configured to process inbound email messages (see Step 5)
Step 1: Set Up a Dedicated Inbox
Each email campaign sends from a dedicated inbox address. If you don't already have one set up for this campaign, you'll need to create one.
Inbox setup is covered in detail in the Email & Inboxes guide. In brief:
- Go to Channels > Inboxes
- Click Create Inbox
- Configure the inbox name, email address slug, and footer text
- For now, skip the Default Workflow setting — you'll set up the reply-handling workflow in Step 5 and connect it then
Once the inbox is active, it serves two purposes: sending your campaign emails (via the Send Email action) and receiving replies (routed to the workflow you'll configure in Step 5).
Step 2: Build Your Member Filter
Member filters define who receives your campaign. You create them in the Members view.
Navigate to the Members view in your workspace. From here, you can filter members based on:
- Labels (e.g., "Enrolled in Program X," "Eligible — Diabetes Management")
- Workflow participation history
- Custom data fields (form submissions)
- Engagement level (message count, last message activity)
- Member role, notification preferences, and more
Creating and saving a member filter involves adding filter rules, configuring match criteria, and saving the filter with a name. For detailed step-by-step instructions, see Creating and Saving Member Filters.
The filter resolves dynamically at send time, so the audience is always based on current data. If a member matches the criteria when the campaign sends, they're included. If they don't, they're not. You don't need to manually export or maintain a list.
Tip: Before sending, review the filtered list to confirm it looks right. Check the member count and spot-check a few entries to make sure your criteria are capturing the audience you intend.
Step 3: Create Your Campaign Workflow and Email Template
The email campaign is powered by a workflow with a Send Email action attached as the entry item on the first task. When a member enters the task, the email fires automatically.
Create the workflow
If you don't have a campaign workflow yet, create one:
- Go to Workflows and click Create Workflow
- Name it (e.g., "Q1 Enrollment Campaign")
- Add a task — this is the task that will send the email when entered
For more on workflow creation, see the Workflows guide.
Create the Send Email action
Next, create a Send Email action and attach it to the task's entry. This action defines the email content — subject line, body (HTML or plain text), and which inbox to send from.
The full step-by-step for creating the action is covered in Creating a Send Email Action on a Workflow Task. The key configuration:
- Trigger: Task Entered, targeting the first task in your campaign workflow
- Action type: Send Email
- Inbox: The inbox you created in Step 1
- Subject: Your email subject line (supports template variables)
- Body: Your HTML or plain text email content
- Content type: Set to
htmlfor HTML campaigns
Personalization with template variables
The subject and body both support template variables using {{variable}} syntax. Common variables for campaigns:
| Variable | Example |
|---|---|
{{member.first_name}} | "Jane" |
{{member.name}} | "Jane Smith" |
{{member.email}} | "jane@example.com" |
{{member.data.SLUG.FIELD}} | Custom form data (e.g., {{member.data.profile.company}}) |
You can also use conditional blocks for optional content:
{% if member.data.profile.company %}
Company: {{member.data.profile.company}}
{% endif %}
For the full list of variables and syntax, see the Template Variables guide.
A note on HTML email: Email clients render HTML inconsistently. If you're using custom HTML, test your email across common clients (Gmail, Outlook, Apple Mail) before sending to your full audience. Keep your layout simple — single-column designs with inline CSS tend to render most reliably.
Step 4: Configure the Scheduled Event
A scheduled event triggers the campaign at a specific date and time. When it fires, Gravity Rail starts the workflow for every member who matches the filter you built in Step 2 — and the entry task's Send Email action delivers the email.
To create a scheduled event:
- Go to Events and click New Event
- Set the schedule type — use Once for a one-time campaign send at a specific date and time, or CRON for recurring sends
- Under Targeting, select Member Filter and choose the saved filter you created in Step 2
- Attach the Send Email action you created in Step 3 (or link the event to the campaign workflow)
- Save the event
For full details on schedule types (Once, CRON, Interval), targeting options, and execution tracking, see the Scheduled Events guide.
Controlling batch size (optional)
You can cap the number of recipients per run if you want to send in controlled batches. When configuring the scheduled event, set a member limit to restrict how many members are processed each time the event fires. This is useful for pilot campaigns or when you want to monitor reply volume before scaling up.
Step 5: Set Up the Reply-Handling Workflow
This is where the campaign goes from outreach to conversation. The reply-handling workflow is a separate workflow connected to the same inbox you set up in Step 1. When a member replies to your campaign email, Gravity Rail:
- Receives the reply at the inbox and links it to the member's conversation thread
- Starts the reply-handling workflow for that member
- The agent reads the full email thread (using its built-in
read_emailtool) and responds according to the workflow's instructions
Connect the workflow to your inbox
- Create a new workflow (e.g., "Campaign Reply Handler") with tasks for how the agent should process replies
- Go to Channels > Inboxes and open the inbox you created in Step 1
- Edit the inbox and set the Default Workflow to your reply-handling workflow
- Optionally set a Default Task if you want replies to start at a specific task
For more on inbox-to-workflow configuration, see the Email & Inboxes guide (the "AI-Powered Email Processing" section).
Design the workflow for reply handling
Your reply-handling workflow should be designed to process any inbound email to this inbox — not just replies to a single campaign. This means the workflow's instructions need to be general enough to handle a range of responses.
Common patterns for reply handling:
- Answer questions — configure the agent with relevant context (attach a File with program details, FAQs, or enrollment information) so it can respond to common questions without human intervention
- Collect information — use Forms to gather structured data from replies (e.g., confirming attendance, updating preferences)
- Escalate when needed — define criteria for when a reply should be routed to a human team member (e.g., complaints, complex clinical questions, requests the agent can't handle). You can use Actions with a Task Entered trigger on an escalation task to notify your team automatically.
- Follow up — the agent can send additional context or next steps based on the member's response
Each reply creates a tracked assignment in your workspace, so your team has full visibility into every conversation and can step in when needed.
Confirm the Result
Once the scheduled event fires, here's how to verify everything is working:
-
Check that emails were sent. Go to Channels > Inboxes and open your campaign inbox. The Messages and Threads tabs show outbound emails that have been sent. Verify that emails appear for the members in your filter. You can also check the scheduled event's execution history (Events > click your event) to see the run status, member count processed, and any errors.
Note: Gravity Rail does not currently surface per-email delivery metrics (open rates, bounce rates) in the UI. If you need delivery confirmation beyond what the inbox view shows, check the event execution log for errors.
-
Verify reply handling. Send a test reply from a member in the audience (or from a test member). Confirm that the reply-handling workflow picks up the message and the agent responds appropriately.
-
Monitor conversations. Go to the Chats view to see active conversations triggered by campaign replies. Use the built-in filters to narrow the list:
- Channel: filter to Email to see only email-triggered conversations
- Workflow: filter to your reply-handling workflow
- Needs Response: shows conversations waiting for human attention
For more on navigating and filtering chats, see the Chats guide.
If replies aren't being processed, check that the reply-handling workflow is active and connected to the correct inbox.
What's Next
- Refine your reply-handling workflow. After the first batch of replies comes in, review how the agent handled them. Adjust instructions, add context to attached Files, or tighten escalation criteria based on what you see.
- Scale to larger audiences. Once you're confident the workflow handles replies well, remove the recipient cap (member limit on the scheduled event) and send to your full audience.
- Set up follow-up sequences. For members who don't reply, consider scheduling a follow-up email. You can do this with a Delayed Action (e.g., trigger a second Send Email action 48 hours after the first task is entered) or by creating a separate Scheduled Event with a CRON schedule targeting members who haven't responded.
- Reuse the pattern. The inbox and reply-handling workflow you built here work for any email campaign. For your next campaign, you only need a new email template and member filter — the infrastructure is already in place.
Related Resources
Build Your First Workflow — Appointment Reminder
Create an automated appointment reminder workflow that contacts members via SMS and handles rescheduling requests.
Build an AI-Powered Knowledge Base from Your Document Library
Upload a document library, enable semantic indexing, and configure your AI agent to search and reference the content during conversations.
Create a Conversational Form — Patient Intake
Build an AI-powered patient intake workflow that collects demographic, insurance, and medical history information through natural conversation.
All Guides
Browse all available guides