Twilio to Google Sheets, qualified leads by text
New leads show up at the worst times. You glance at the form submission, tell yourself you’ll reply “in a minute,” and then two hours disappear into showings, calls, and admin.
This Twilio Sheets leads automation hits real estate agents first, but marketing managers routing inbound inquiries and small team owners running sales off a website form feel it too. The goal is simple: reply instantly, ask the right questions, and hand off a clean summary without digging through text threads.
You’ll see how this workflow starts an SMS conversation, keeps context across replies, and logs a qualified lead summary into Google Sheets so follow-up is fast and consistent.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Twilio to Google Sheets, qualified leads by text
flowchart LR
subgraph sg0["Wait for Text Response Flow"]
direction LR
n1@{ icon: "mdi:memory", form: "rounded", label: "Postgres Chat Memory", pos: "b", h: 48 }
n2@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model1", pos: "b", h: 48 }
n3@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n4@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model2", pos: "b", h: 48 }
n5@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser1", pos: "b", h: 48 }
n6@{ icon: "mdi:robot", form: "rounded", label: "Real Estate Qualifier", pos: "b", h: 48 }
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/twilio.svg' width='40' height='40' /></div><br/>Wait for Text Response"]
n10@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Check if Conversation Comple..", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/twilio.svg' width='40' height='40' /></div><br/>Thank Your Text"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/twilio.svg' width='40' height='40' /></div><br/>Response Text from Agent"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/postgres.svg' width='40' height='40' /></div><br/>Query Supabase for conversat.."]
n14@{ icon: "mdi:cog", form: "rounded", label: "Combine Rows", pos: "b", h: 48 }
n15@{ icon: "mdi:robot", form: "rounded", label: "Summarize Transcript", pos: "b", h: 48 }
n16@{ icon: "mdi:database", form: "rounded", label: "Store results in google ", pos: "b", h: 48 }
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/twilio.svg' width='40' height='40' /></div><br/>Send Lead to owner"]
n3 --> n6
n14 --> n15
n2 -.-> n15
n4 -.-> n6
n1 -.-> n6
n15 --> n16
n6 --> n10
n9 --> n3
n16 --> n17
n5 -.-> n15
n10 --> n13
n10 --> n11
n10 --> n12
n13 --> n14
end
subgraph sg1["On form submission Flow"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/form.svg' width='40' height='40' /></div><br/>On form submission"]
n7@{ icon: "mdi:cog", form: "rounded", label: "Wait 5 Seconds", pos: "b", h: 48 }
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/twilio.svg' width='40' height='40' /></div><br/>Initial Text Message"]
n7 --> n8
n0 --> n7
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n9,n0 trigger
class n5,n6,n15 ai
class n2,n4 aiModel
class n1 ai
class n10 decision
class n13,n16 database
classDef customIcon fill:none,stroke:none
class n9,n11,n12,n13,n17,n0,n8 customIcon
Why This Matters: Speed-to-lead dies in your inbox
When someone fills out a “schedule a tour” form, they’re usually still in decision mode. If your reply comes later, they’ve already moved on, or worse, they’ve started five parallel conversations and you’re now competing on who responds fastest. The manual version also creates messy notes: a few texts here, a call log there, maybe a CRM entry if you remember. Then you’re trying to “reconstruct” budget, location, and timeline right before you call them. Honestly, it’s exhausting.
The friction compounds. Here’s where it breaks down.
- You don’t respond immediately, so the lead goes cold while you’re busy doing actual work.
- Qualification questions get asked inconsistently, which means you chase people who were never a fit.
- Conversations live in one-off SMS threads, so handoffs to another agent turn into screenshots and guesswork.
- Even when you do qualify someone, the “summary” is scattered across tabs and memory, and mistakes slip in.
What You’ll Build: An SMS lead qualifier that logs clean summaries
This workflow turns a website form submission into an instant, two-way SMS conversation using Twilio. The moment a lead comes in, the workflow sends an intro text and starts a guided chat powered by an AI Agent, asking the exact questions you care about (budget, location, timeline, and anything else you add). As the lead replies, the workflow keeps context by storing chat history in PostgreSQL (often via Supabase), tied to the buyer’s phone number, so the conversation doesn’t “reset” with every message. When the agent detects the conversation is complete, it pulls the full history, generates a structured summary, and appends a clean row into Google Sheets. Finally, it notifies you (or your team) by SMS so you can follow up with confidence.
The workflow begins with a form trigger, then moves into outbound SMS and inbound reply handling via Twilio. Memory and chat history storage keep everything coherent across multiple messages. Once the qualification is done, OpenAI generates a readable handoff and Google Sheets becomes your single, searchable lead log.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you get 10 inbound leads a week. Manually, you might spend about 10 minutes per lead just doing the basics: sending a first text, asking a few questions, and then copying notes into a sheet or CRM, which is roughly 100 minutes. With this workflow, the only “manual” time is scanning the Google Sheets summary and replying when needed, maybe 2 minutes per lead. That’s about an hour back every week, plus faster replies that you simply won’t manage consistently by hand.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Twilio for sending and receiving SMS
- Google Sheets to store the lead summary log
- OpenAI API key (get it from your OpenAI dashboard)
Skill level: Intermediate. You’ll connect a few accounts, paste credentials, and test a webhook/SMS flow end-to-end.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A new form submission kicks things off. The workflow listens for a lead coming in (name, phone, maybe a property URL), then starts the automation immediately.
The lead gets an intro text via Twilio. After a short pause to avoid race conditions, it dispatches the first SMS so the lead knows you received their request and what happens next.
Replies are captured and the AI Agent runs the conversation. Inbound SMS messages trigger the workflow, which pulls conversation memory from PostgreSQL and feeds it to the OpenAI chat model so the agent can ask the next question naturally.
Once the conversation is “done,” the workflow writes the handoff. It aggregates the stored chat history, generates a structured summary, appends it to Google Sheets, and sends you a final SMS notification so you can follow up fast.
You can easily modify the qualification questions to match your market and your inventory. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Form and SMS Triggers
Set up the inbound entry points so leads can submit the form and reply by SMS.
- Open Form Submission Trigger and set Form Title to
Real Estate Inquiry. - In Form Submission Trigger, add a field with Field Label set to
Phoneand set Form Description toPlease enter your phone number with country code (example +1). - Open Inbound SMS Trigger and confirm Updates includes
com.twilio.messaging.inbound-message.received. - Keep Flowpast Branding as an optional sticky note for documentation; it has no effect on execution.
Step 2: Connect Twilio, Postgres, and Google Sheets
Attach credentials for the services used across the workflow so SMS, memory, and logging can run.
- In Inbound SMS Trigger, Dispatch Intro SMS, Send Thank You SMS, Send Agent Reply SMS, and Notify Owner via SMS, add credentials: Credential Required: Connect your
twilioApicredentials. - In Postgres Conversation Memory and Fetch Chat History, add credentials: Credential Required: Connect your
postgrescredentials. - In Append to Google Sheet, add credentials: Credential Required: Connect your
googleSheetsOAuth2Apicredentials. - For AI components, OpenAI Chat Model Alpha and OpenAI Chat Model Beta require: Credential Required: Connect your
openAiApicredentials.
[YOUR_ID] placeholders in Twilio From and Google Sheets Document ID with actual values before testing.Step 3: Configure the Initial Outreach Flow
Send an introductory SMS shortly after the form is submitted.
- In Pause Briefly, set Amount to
10to add a short delay after form submission. - In Dispatch Intro SMS, set To to
={{ $json.Phone }}. - Set From in Dispatch Intro SMS to
[YOUR_ID]. - Set Message in Dispatch Intro SMS to
Thanks for submitting the form on our website. Do you have a few minutes to answer a few questions?.
10 seconds.Step 4: Set Up the AI Qualification Loop
Route inbound SMS replies into the AI agent for qualification and decide whether to continue or complete the conversation.
- Confirm the flow Inbound SMS Trigger → Hold for Reply → Lead Qualification Agent is connected as shown in the workflow.
- In Postgres Conversation Memory, set Session Key to
{{ $('Inbound SMS Trigger').item.json.data.from }}and Session ID Type tocustomKey. This memory node is attached to Lead Qualification Agent; ensure the Postgres credential is configured on Postgres Conversation Memory. - In OpenAI Chat Model Beta, set Model to
gpt-4oand attach it to Lead Qualification Agent as the language model. - In Lead Qualification Agent, set Text to
={{ $json.data.body }}and keep Prompt Type asdefine. - Set System Message in Lead Qualification Agent to
=You are a friendly real estate assistant helping qualify new leads for a realtor. Ask only three brief questions, then end the conversation politely. Keep the tone warm and professional. Your goal is to gather basic information to help the realtor follow up later. 1. Ask for their name. 2. Ask what type of property they’re looking for (e.g., house, condo, rental). 3. Ask what city or neighborhood they’re interested in. Once all three answers are collected, thank them and let them know a realtor will follow up soon. also add *** to the response. - In Conversation Completion Check, set the condition to String contains with Left Value
={{ $json.output }}and Right Value***. - If the condition is false, the flow continues to Send Agent Reply SMS. Set To to
={{ $('Inbound SMS Trigger').item.json.data.from }}and Message to={{ $json.output }}.
Step 5: Configure Completion Actions and Logging
When the agent signals completion, summarize the conversation and log it while sending final notifications.
- Conversation Completion Check outputs to both Fetch Chat History and Send Thank You SMS in parallel.
- In Send Thank You SMS, set To to
={{ $('Inbound SMS Trigger').item.json.data.from }}and Message to=Thanks, I'll give you a call soon.. - In Fetch Chat History, set Operation to
executeQueryand Query toSELECT * FROM n8n_chat_histories WHERE session_id = '{{ $('Inbound SMS Trigger').item.json.data.from }}';. - In Aggregate History Records, set Aggregate to
aggregateAllItemData. - In OpenAI Chat Model Alpha, set the model to
gpt-4o-miniand attach it to Summarize Conversation as the language model. - In Structured Output Parser, keep JSON Schema Example as
{ "transcript": "transcript", "summary": "summary" }and connect it to Summarize Conversation as the output parser (no credentials needed for the parser itself). - In Summarize Conversation, set Text to
={{ $json.data }}, enable Has Output Parser, and set System Message to=output two fields a clean transcript of the conversation and a summary of the conversation. - In Append to Google Sheet, set Operation to
append, Document ID to[YOUR_ID], and Sheet Name togid=0(Sheet1). Map columns: Phone =={{ $('Inbound SMS Trigger').item.json.data.from }}, Summary =={{ $json.output.summary }}, Transcript =={{ $json.output.transcript }}. - In Notify Owner via SMS, set To to
={{ $('Inbound SMS Trigger').item.json.data.from }}and Message to=*** You just got a new lead. Here's a transcript of the interaction with our AI Bot. ***{{ $json.Summary }}***.
Phone, Summary, and Transcript to match the mapping in Append to Google Sheet.Step 6: Test and Activate Your Workflow
Validate the full SMS loop, AI responses, and logging before turning the workflow on.
- Click Execute Workflow and submit a test entry via Form Submission Trigger with a real phone number.
- Confirm you receive the intro SMS sent by Dispatch Intro SMS, then reply to trigger Inbound SMS Trigger and the AI loop through Lead Qualification Agent.
- Verify that a non-completed conversation sends a reply from Send Agent Reply SMS, and that a completed conversation routes through the parallel path to Send Thank You SMS and Fetch Chat History.
- Check that Append to Google Sheet creates a new row with the phone number, summary, and transcript, then confirm Notify Owner via SMS sends the final notification.
- When everything works as expected, toggle the workflow to Active for production use.
Troubleshooting Tips
- Twilio credentials can expire or need specific permissions. If things break, check the Twilio Console (Messaging settings and phone number webhooks) first.
- If you’re using Wait nodes or external processing, timing varies. Bump up the wait duration if downstream nodes fail on empty responses.
- OpenAI prompts that are left generic will feel “chatty” and off-brand. Add your voice and your must-ask questions early, or you will be editing summaries forever.
Quick Answers
About 45 minutes if your Twilio number and Google Sheet are ready.
No. You’ll mostly connect accounts and adjust a few AI prompts and fields.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs (often just a few dollars a month at low lead volume) and Twilio SMS fees per message.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. You can rewrite the questions in the Lead Qualification Agent, change what gets extracted by the Structured Output Parser, and map new columns in the Append to Google Sheet step. Many teams also swap the “notify owner” step so the handoff goes to a shared inbox, a second agent, or even Pipedrive instead of (or in addition to) Sheets.
Usually it’s the webhook URL on your Twilio phone number not pointing to the right Inbound SMS Trigger in n8n, or an Auth Token/SID that was rotated. Double-check the Twilio Console for the Messaging webhook settings, then re-test by sending a real SMS from your phone. If it fails only sometimes, you may also be hitting messaging limits or the workflow is responding before memory/history is available, so increasing the wait can help.
If you self-host, there’s no execution limit (it mainly depends on your server and Twilio throughput). On n8n Cloud, the practical limit depends on your plan’s monthly executions, since each SMS back-and-forth can trigger multiple runs. For most small teams doing a few leads a day, it’s comfortably within entry plans, but high-volume campaigns should budget for more executions and higher SMS spend.
Often, yes. Two-way SMS plus “memory” is where simpler tools start to feel awkward, because each message needs context and branching logic. n8n handles that branching without nickel-and-diming you for paths, and you can self-host when volume grows. It also plays nicely with databases like Postgres for chat history, which is a big deal for conversations that span hours or days. Zapier or Make can still work if you only need a basic “send a text, log a row” flow with no real back-and-forth. Talk to an automation expert if you want help choosing.
Once this is live, your leads get an immediate, consistent experience and you get clean notes in one place. Set it up, test it twice, and let the workflow handle the repetitive parts.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.