Pixel2Tech
All projects
AI AutomationAI Agents & Chatbots

SMS-first AI lead nurture with agent handoff

We built this for a real estate team that manages its leads in Lofty CRM and wanted SMS to be the first point of contact. The AI handles the early back-and-forth over text, decides when a lead is worth an agent's time, and leaves the agent in control of the handoff. The core conversation and handoff paths are built out, while branches such as the daily summary and quiet-lead re-ping were laid out for the team to finish connecting as their accounts were set up.

Practice
AI Automation
Service
AI Agents & Chatbots
Type
Client automation

The work

How the automation works

  1. SMS-first AI lead nurture with agent handoff: The full n8n workflow: SMS conversation, agent reply flow, daily summary, media add-on and lead re-ping, each with its own note.
    1.The full n8n workflow: SMS conversation, agent reply flow, daily summary, media add-on and lead re-ping, each with its own note.
  2. SMS-first AI lead nurture with agent handoff: The SMS conversation path: Twilio trigger, Supabase history, OpenAI reply, qualification check, Lofty status update and agent alert.
    2.The SMS conversation path: Twilio trigger, Supabase history, OpenAI reply, qualification check, Lofty status update and agent alert.
  3. SMS-first AI lead nurture with agent handoff: The agent reply flow: find the lead by the agent's phone, then confirm the booking or send the agent's question to the lead.
    3.The agent reply flow: find the lead by the agent's phone, then confirm the booking or send the agent's question to the lead.
  4. SMS-first AI lead nurture with agent handoff: The end-of-day branch that pulls the day's leads and chats, prepares a summary and texts it to the agent.
    4.The end-of-day branch that pulls the day's leads and chats, prepares a summary and texts it to the agent.
  5. SMS-first AI lead nurture with agent handoff: The re-ping branch that checks lead status and sends a follow-up SMS to leads who have not replied.
    5.The re-ping branch that checks lead status and sends a follow-up SMS to leads who have not replied.

Project brief

Deliverables

  • Twilio SMS trigger and reply path
  • Supabase message history with the last 10 messages as context
  • OpenAI prompt that returns a reply and qualification data
  • Lofty status update to Ready for Agent with an agent SMS alert
  • Agent reply webhook with approve and ask-for-more paths
  • Daily summary and quiet-lead re-ping branches

The challenge

Real estate leads expect a quick reply, often by text, but agents can't answer every message the moment it arrives. Leads that wait go cold, and agents spend time on people who are not ready to move. The team needed fast, consistent replies with a clear point where a person takes over.

Our approach

A Twilio trigger receives each inbound SMS. The workflow extracts the lead's message and number, saves it to a messages table in Supabase and fetches the last 10 messages for context. A prompt with system instructions, examples and that history goes to OpenAI, and the response is parsed into the reply text and qualification metadata. The reply is saved back to Supabase and sent to the lead through Twilio. Qualification logic then checks the lead: if qualified, its status in Lofty is set to Ready for Agent and the agent gets a hot-lead SMS. The agent answers by text to a separate webhook; the workflow finds the lead by the agent's phone number and either confirms the booking with the lead or, if the agent asked for more information, passes the question to the AI and texts the lead a follow-up. The design also includes an end-of-day summary texted to the agent, a check that re-pings leads who have gone quiet, and an optional media add-on that turns summaries into Gemini images and short videos for Facebook.

The outcome

Leads get a text reply that takes the whole conversation into account. Agents only step in for leads the AI has qualified, approve them or ask questions from their phone, and see the status in Lofty. The re-ping and daily summary branches give the team a way to keep quiet leads warm and review the day without opening every thread.

Trigger
Inbound SMS from a lead
Stack
Twilio, OpenAI, Supabase, Lofty CRM
Handles
Replies, qualification and agent handoff

How we did it

  1. Step 01

    Define qualification

    We agreed with the team what makes a lead ready for an agent and how the AI should word its replies.

  2. Step 02

    Build the conversation loop

    We connected Twilio, the Supabase history and OpenAI so each reply draws on the recent conversation.

  3. Step 03

    Add the handoff

    We added the Lofty status update, the agent SMS alert and the agent reply webhook with its two paths.

  4. Step 04

    Lay out the follow-up branches

    We mapped the daily summary, quiet-lead re-ping and media add-on for the team to connect as their accounts were ready.

Tools and platforms

  • n8n
  • Twilio
  • OpenAI
  • Supabase
  • Lofty CRM
  • Google Gemini

Why this project matters

Speed matters with inbound leads, and so does an agent's time. This build answers every text quickly and only pulls an agent in when the conversation is ready for one.

Questions about this project

Does the agent have to approve every handoff?

The agent is alerted for each qualified lead and replies by text to approve it or ask for more information. A question goes to the lead as a follow-up text, so the agent decides when a lead is handed over.

Can you build something similar for my business?

Yes. We set it up with your SMS number, your CRM and your own qualification rules. Book a short call and we will come back with a fixed quote.

Have a project like this in mind?

Tell us what you're working on. We'll come back with a clear plan and a realistic timeline.

Send a project brief
WhatsApp us