Build Lifecycle Email with Your AI Agent: A Supabase Tutorial
Build a Supabase welcome sequence through Dreamlit MCP: let your AI agent read the schema, draft emails, preview real data, send a test, and ask before publishing.

Andrew Kim

You can build a welcome sequence from the same AI agent you use to work on your app. Connect Dreamlit through the Model Context Protocol (MCP), explain who needs the email and why, then review a draft built from your Supabase data. You approve a test send and publication separately.
This tutorial uses Boardwalk, a made-up SaaS app where teams organize client projects. We'll welcome a new member, wait two days, and send one follow-up only if they still haven't created a project. Boardwalk and every prompt and reply below are examples, not a customer story or a transcript from a live account.
Last validated: November 11, 2026 against the Dreamlit MCP reference.
1. Add Dreamlit to your agent
Start a 7-day free trial. A card is required; Pro costs $20 a month after the trial, and you can cancel anytime.
Follow the setup guide for Claude Code, Codex, or Cursor. The MCP overview lists other clients. Dreamlit hosts the server at https://mcp.dreamlit.ai/mcp, so you don't run a local Dreamlit server.
Authorize the workspace and review the permissions. Reading workflows, editing drafts, publishing, and reading analytics have separate scopes. Reconnect your agent session if the tools don't appear.
Example prompt:
Check Dreamlit status and list my projects. Use the Boardwalk project.
Tell me what setup is missing. Don't create or publish anything yet.The agent starts with get_status and uses list_projects if needed. If setup is incomplete, open the returned Dreamlit link. Connect your Supabase project using the Supabase connection guide and verify a sending domain.
Dreamlit uses a database user you create, installs small triggers and its own dreamlit schema, and doesn't change your app's rows. You don't add tracking events or email API calls to Boardwalk's code.
2. Let the agent learn your app and schema
Use a coding agent with access to your repository, or provide a small schema description yourself. Local file access comes from that agent's tools. Dreamlit MCP supplies project context and schema hints; it isn't a general-purpose SQL console.
For this example, Boardwalk already has these tables:
| Table | Relevant fields | Meaning |
|---|---|---|
public.profiles | id, email, first_name, created_at, onboarding_emails_enabled, deleted_at | Boardwalk creates this row after a confirmed signup |
public.projects | id, owner_id, created_at | A member creates their first client project |
These are illustrative names. Use the fields your app actually saves, including its consent and account-status fields.
Example prompt:
Read the schema and signup code in this repository. Explain when a
profile is created and how a project links to its owner. Then inspect
Boardwalk's existing Dreamlit workflows. Flag any missing data you
would need for a welcome sequence. Don't edit application data.The agent can call list_workflows and inspect relevant workflows with get_workflow_and_preview_url to avoid duplicating an existing welcome email.
Example reply:
Boardwalk creates a profile after signup confirmation. Projects link through owner_id. I can use that relationship to check whether someone finished setup. I'll use onboarding_emails_enabled for this optional sequence and skip deleted profiles.
Verify this explanation against your app before continuing. A plausible field name isn't proof that it means what the agent assumes.
3. Ask which lifecycle email is missing
Start with a small decision: what should help the user do one useful thing?
Example prompt:
What's missing between signup and creating a first client project?
Recommend one lifecycle workflow based on our schema and existing
workflows. Explain who gets it and when it should stop.Example reply:
Start with a welcome message linking to project creation. After two days, remind members who still have no projects. Skip anyone who opted out or deleted their account. Don't send the reminder to someone who already finished setup.
For broader analysis, get_lifecycle_report and get_recommendations return Dreamlit's prepared reports on Pro and Scale. They may return processing first. Check back later without requesting a fresh report each time. You don't need to wait for a report to build this one sequence.
4. Build one welcome sequence as a draft
Give the agent the trigger, audience, timing, copy goal, and stopping rules together.
Example prompt:
Create a draft called Boardwalk welcome.
When a new public.profiles row is inserted, send a short welcome
email if onboarding_emails_enabled is true and deleted_at is null.
Link to https://boardwalk.example/projects/new.
Wait two days, then query the current profile and its projects again.
Send one helpful reminder only if the profile still exists, is active,
has onboarding emails enabled, and owns no projects. Otherwise stop.
Use the current email address. Enable unsubscribe for this optional
onboarding sequence. Don't publish it or send tests yet.The agent uses create_or_update_workflow, then inspects the result. It can revise the draft when validation reveals a missing field or unclear rule. Expect a workflow link you can review.
The second query matters. Keeping only the signup-time data would miss a project created during the two-day wait. Ask for a fresh query after the wait so the reminder checks current activity, consent, and account status.
5. Preview with real data you control
Open the returned Dreamlit preview link and use a real test profile from your connected database. Keep personal information out of screenshots or shared chats. The example name below represents that controlled test account.
Example prompt:
Inspect the draft and give me its preview URL. Walk me through the
welcome email and the reminder using my test profile, Ada.
Show which fields personalize the message. Keep it unpublished.get_workflow_and_preview_url lets the agent inspect the draft and return its preview link. Review the rendered messages in Dreamlit's test interface.
Check three paths: an eligible member with no project, a member who created a project during the wait, and an opted-out or deleted member. The last two should receive no reminder. Confirm the destination link, sender, subject, name fallback, and unsubscribe link.
6. Approve a test to your inbox
A preview checks data and layout; a test shows the message in your actual email client.
Example prompt:
Prepare a test of the welcome message to my account email.
Show the recipient and message before sending. Use the preview data
we just checked, and keep the workflow unpublished.send_workflow_test returns confirmation_required. If there are multiple messages, it may first ask you to choose one.
Example reply:
The test will send the welcome message to your account email. It won't publish the workflow. Shall I send this test?
After you explicitly approve, the agent calls the tool again with confirmSend: true. Check your inbox, mobile layout, links, and reply address. Repeat for the reminder. Tests don't publish or change the draft.
7. Publish only after explicit approval
Ask the agent to prepare publication, not to skip straight to going live.
Example prompt:
Prepare publishing Boardwalk welcome. Show the preview link, trigger,
audience, two-day wait, exit rules, and any warnings. Wait for approval.The agent calls prepare_publish. Review the prepared request and resolve warnings. If the draft changes, prepare publication again.
Example approval:
I approve publishing this prepared Boardwalk welcome workflow with the rules shown.
Only then should the agent call confirm_publish. Once published, matching future signups run the sequence automatically. You aren't asked to approve every later live email. Publishing this database-triggered workflow isn't a request to backfill all existing members.
8. Check results and ask for one improvement
After eligible users have had time to reach the follow-up, inspect delivery and workflow activity before changing copy.
Example prompt:
Show recent Boardwalk welcome runs and per-recipient email activity.
Summarize deliveries, bounces, opens, and clicks. Flag failures, and
suggest one improvement as a draft. Don't publish changes.The agent uses get_analytics, filtered to this workflow. Opens and clicks are email activity, not proof that someone created a project. Compare them with your app's own project-creation data before drawing conclusions about onboarding.
Example reply:
I'll check failed runs and link clicks first. If readers click but don't finish setup, review the destination page before rewriting the email. Any workflow changes will stay in draft for another preview and approval.
Where Dreamlit fits
Dreamlit, the company behind this blog, runs lifecycle email from your Supabase or Postgres database through your AI agent. It handles the workflow layer: triggers, queries, waits, templates, and sending. It isn't a drop-in SMTP or REST transport.
For the other side of this setup, see sending emails from Supabase and Supabase Auth templates. Auth delivery and this optional welcome sequence are separate jobs.
Start a 7-day free trial and build your first draft. Card required. Pro is $20 a month after the trial. Cancel anytime.
Frequently asked questions
Which AI agents can use Dreamlit MCP?
Use an agent that supports remote MCP over Streamable HTTP. Dreamlit has setup guides for Claude Code, Codex, Cursor, Claude Desktop, Gemini CLI, VS Code, Windsurf, and other clients. Your agent needs access to your project files if you want it to read local schema or migration files.
What can my agent access?
OAuth access is limited to the workspace and permissions you approve. A personal access token is limited to one project. Dreamlit tools can inspect setup, workflows, previews, and notification analytics, and create or edit drafts with the right permissions. Dreamlit uses a database user you create, installs small triggers and its own dreamlit schema, and doesn't change your app's rows. Local code access comes from your agent, not the Dreamlit MCP connection.
Will it send email without my approval?
Drafting doesn't start live sends. A test send has its own confirmation step and sends only after you approve. Publishing uses prepare_publish followed by confirm_publish after you approve the prepared request. Once published, the workflow sends automatically when its rules match; you don't approve each later live send. Review tool calls and grant only the permissions you need.
What does Dreamlit cost, including the trial?
New accounts can start a 7-day free trial of Pro, or subscribe to Scale, which has no trial. A card is required for the trial, you aren't charged until the trial ends, and you can cancel anytime. Pro then costs $20 a month and includes 30,000 emails a month. There is no permanent free plan for new accounts. Connecting MCP doesn't add a separate charge; workflow authoring uses your plan's AI agent credits. Your agent provider's own terms still apply.
About the Author

Co-Founder & CTO
Andrew is Co-Founder and CTO of Dreamlit AI, which runs user activation for software companies. He previously built partner integrations at Netflix and led engineering at fintech startup Bonside. Full bio →
Other articles

How to Send Emails from Supabase (Beyond the 2/Hour Limit)
Supabase's built-in email sender allows 2 emails per hour. How to send emails from Supabase in production: custom SMTP, Send Email Hook, webhooks, and cron.

Supabase Email Templates (2026): Variables, Setup, Fixes
Supabase email templates explained: where they live, every template variable, the June 2026 free-plan change, custom SMTP setup, and fixes for common breakages.