How to Build an SMS Chatbot with Twilio

Last Updated: 
August 5, 2025
August 5, 2025
Expert written and reviewed
Verify logo
Written by
Alex Shkoni
Reviewed by
Reviewed by
Voiceflow team

In this guide, I'll walk you through exactly how to build your own SMS chatbot using Twilio, Voiceflow, and Make.com. No coding required.

We'll start by building a simple FAQ agent in Voiceflow that uses Retrieval-Augmented Generation (RAG) to pull accurate answers from your own knowledge base. You'll learn how to gather your resources, set up your knowledge base, and get your Voiceflow agent ready to help real users.

Once your agent is set up, I'll show you how to connect it to Twilio so it can send and receive SMS. We'll use Make.com as our backend to automate the whole process.

By the end of this guide, you'll have a fully working SMS chatbot that can answer customer questions 24/7 using your own business info.

Let's get started by building your agent in Voiceflow.

Voiceflow Agent setup

We're going to build a simple FAQ agent in Voiceflow that uses RAG (Retrieval-Augmented Generation) to answer user questions.

You don't have to start from scratch - I'll provide a template you can download and use. This template is RAG-based: when a user asks something, the agent will search your knowledge base for answers.

Creating Your Knowledge Base

Start by gathering all your resources: website URLs, PDFs, policy docs, FAQs - basically any material your users might have questions about. Voiceflow lets you add all of this to a knowledge base, which your agent will search through to find the right answers.

Here's how to set it up:

- Upload your documents to the Knowledge Base section in Voiceflow (Image 1).

- Connect the knowledge base to your agent (Use provided template - it has a built in function for this)

Image 1 - upload files to knowledge base

💡 Pro Tip: Most websites have a sitemap (for example, https://yourwebsite.com/page-sitemap.xml or you can find it by checking /robots.txt). Instead of uploading pages one by one, you can import the whole sitemap into Voiceflow. This saves you a ton of time and gets your agent up and running faster!

{{blue-cta}}

If you want to follow along, I used these 3 urls from a website I found as my knowledge base sources:

https://aroundaboutcars.com/about/insurance

https://aroundaboutcars.com/contact/

https://aroundaboutcars.com/car-hire-cape-town/

Prompt Engineering for RAG

When working with a RAG-based agent, how you ask the AI to use your knowledge base matters. The prompt engineering you set up tells the agent how to find answers and what to do when it can't.

I'll provide you with a starter prompt template, but here are a few basics to keep in mind:

- Be specific: Tell the agent to answer only using information from your knowledge base.

- Handle uncertainty: Make sure the agent says "I don't know" or something similar if the info isn't found.

- Keep it simple: The best prompts are clear and easy to follow.

Example Prompt:

*You are an AI assistant communicating with clients via SMS. Your role is to be a helpful consultant, providing accurate information based solely on the provided context.*

*## Your core responsibilities: *
*1. Provide accurate responses using only the given context inside  tag. *
*2. Never introduce external knowledge for context-based questions. *
*3. If the user greets you or engages in small talk (e.g., "hello", "whatsup", "how u doing", "What's up?", "How are you doing?"), respond with a friendly greeting or a simple neutral reply that does not rely on external data. *
*4. Respond with "NOT_FOUND" ****without any additional words**** when context is insufficient for the user's factual question.*

*## Core rules for context-based questions: *
*1. Use only information from  to base your answers. *
*2. Analyze the entire context to find relevant information. *
*3. You can combine different pieces of information to form a complete answer.*
*4. Your tone is - helpful, neutral and direct.*
*5. Use plain text only. Do not use Markdown, lists, or any special formatting. Keep messages clear and direct. If you can stay under 160 characters, do so; if not, it's fine to go longer. If you must list items, put each on a new line. *
*6. If the question is factual but you cannot find any relevant info in the context, respond with "NOT_FOUND".*

After you're done with building out your workflow on Voiceflow, don't forget to publish it (Image 2).

Image 2 - publishing your Agent

Why SMS Length Matters

When you send a text longer than 160 characters, it's actually broken up into 153-character segments behind the scenes. This means long messages use up more SMS "segments," which can quickly increase your messaging costs - especially if you're sending lots of replies.

It gets even tighter if you use emoji or special characters, since those messages get split at just 70 characters per segment.

To help save on costs, it's best to keep replies short and clear. That's why we'll set up our AI agent to give concise answers by default, so you get the info you need - without racking up extra SMS charges.

You can read more about it here - SMS character limits on Twilio

Twilio setup

To send and receive SMS through Twilio, you need to have an active Twilio phone number. If you already have one - great, you're set! If not, just log in to your Twilio account and buy a number that supports SMS.

Next, if you want to use Twilio phone numbers for business SMS, you'll need to go through one or both of these compliance steps:

1. 10DLC Registration (for the US):
To send SMS from US phone numbers, businesses must register their brand and messaging campaigns with carriers. This process is called 10DLC registration. You'll fill out a form in Twilio, providing your company name, EIN (tax ID), website, and details about how you'll use messaging (for example, alerts, marketing, customer support). This is required by US carriers to help prevent spam and protect consumers.

2. Create a Regulatory Bundle (for many countries outside the US):
If you want to use local phone numbers in many countries (like in Europe or Asia), you'll need to submit a Regulatory Bundle in Twilio (Image 3). This means uploading documents that prove your business or personal identity, such as your registration certificate or proof of address. This step is required by law in many countries before you can activate and use your Twilio number for SMS or calls.

You'll need to complete these compliance steps in Twilio so your phone numbers can work reliably for business use, and to make sure your messaging stays legal and isn't blocked.

Image 3 - Regulatory Bundle Requirement

Messaging configuration

Now that you have your Twilio number, the next step is to connect it to your backend so you can handle conversations automatically.

In your Twilio number settings (Image 4), you'll need to paste your Make.com webhook URL into the "A message comes in" field. This tells Twilio where to send incoming messages for processing.

- When someone texts your Twilio number, Twilio will send all the message details straight to your webhook.

- From there, your Make scenario can take over - passing the message to Voiceflow, handling logic, and sending replies back via Twilio.

If you haven't set up your webhook yet, don't worry - we'll do exactly that next in Make.com. You'll see how to build the backend logic that connects Twilio and Voiceflow, step by step.

Image 4 - messaging configuration with Make.com webhook

{{blue-cta}}

Make.com setup

Connecting Twilio with Voiceflow through Make might sound technical, but I've made it super simple for you. You don't need to study the Voiceflow API or write any backend code yourself.

I've put together a ready-to-use template that takes care of all the tricky parts behind the scenes. All you have to do is create a scenario in Make.com, import my template, and fill in a few fields with your own info - no API knowledge needed.

Here's the template to get you started. Just import it and follow the steps - you'll have your SMS chatbot running in minutes.

What's Happening in This Scenario?

This scenario (Image 5) lets you connect Twilio (for sending/receiving SMS) with Voiceflow (your conversational AI platform). The logic: when someone sends an SMS to your Twilio number, the message gets sent to Voiceflow, which processes it and sends back a reply via SMS.

How Does It Work? (Step-by-Step)

1. Twilio Webhook

- When someone sends a text message to your Twilio phone number, Twilio sends all the message info (like sender, body, etc.) to a webhook in Make.

2. Make Scenario Trigger

- This webhook triggers your scenario in Make.com.

- The scenario grabs all the SMS info from Twilio.

3. Check/Create User in Voiceflow

- The scenario checks if the sender (phone number) is a new or existing user in Voiceflow.

- If new, it triggers a "launch" action to start the conversation for the first time.

- If existing, it just continues the chat.

4. Send Message to Voiceflow

- The scenario sends the text of the SMS (the message body) to your Voiceflow assistant using the Voiceflow API.

5. Get Response from Voiceflow

- Voiceflow processes the user's message and generates a reply.

6. Send Reply via Twilio

- The scenario takes Voiceflow's response and sends it back as an SMS using Twilio, right to the original sender.

7. (Optional) Log the Conversation

- It can log the conversation to Voiceflow transcripts for analytics.

Image 5 - Make.com scenario for handling conversations using Voiceflow and Twilio

What Do You Need to Provide?

- Twilio Account SID and Auth. You can find both of these values in the Twilio console home page. This will be needed for you to connect the Twilio module in Make with our account.

- Voiceflow ProjectID with an API key.

In Short

- Incoming SMS goes to Make via Twilio webhook.

- Make passes the message to Voiceflow for processing.

- Voiceflow creates a reply.

- Make sends the reply back via Twilio SMS.

That's it - that's the entire backend of your messaging bot. Make sure to save the Make.com scenario and send your first message.

Testing the SMS chatbot

Here is how my interaction looked like from SMS (Image 6). You can see that one question failed to answer - that's completely fine. We might need to add more sources to the knowledge base or adjust the prompt. That's an expected and normal part of building out any kind of AI agent.

Image 6 - interaction with our SMS chatbot

Conclusion

And there you have it - your very own AI-powered SMS agent, up and running! Pretty cool, right? You've got a smart bot that can answer user questions, search through your business docs, and respond instantly to incoming messages.

If this all feels a bit overwhelming at first, don't worry - just start small. Get your basic FAQ flow working, then gradually add more features over time. Focus on perfecting your knowledge base, then explore capturing leads or integrating with more platforms.

If you don't want to get into the details of building an SMS chatbot with Twilio, learning Voiceflow, or messing with Make.com setups, just book a call with us - we'll handle the entire SMS automation for you, from setup to launch https://www.parnidia.com/

Happy building! 🚀

Contributor
Verify logo
Content reviewed by Voiceflow
Co-founder & CTO @ Parnidia
CTO & Co-founder of Parnidia. We build AI solutions for top e-commerce brands and clinics.
Build an SMS chatbot with Voiceflow
Get started, it’s free
Build an SMS chatbot with Voiceflow
Get started, it’s free
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.

Keep Reading

See all
No items found.

Start building AI Agents

Want to explore how Voiceflow can be a valuable resource for you? Let's talk.

ghraphic