> ## Documentation Index
> Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reply to text messages with your AI agent using SMS

> Import your Twilio numbers so your AI agent replies to the texts customers send them, with Helpdesk takeover

The Chatbase SMS channel connects your Twilio phone numbers to an AI agent, so it answers the texts customers send to those numbers. It's for businesses whose customers text them, such as clinics confirming appointments or stores answering order questions. Your team can take over any conversation from the Helpdesk and keep texting the customer from the same number.

> [card] What you can do:
>
> Answer texts automatically with the same knowledge, Actions and instructions as your chat AI agent, read the photos customers text you, and hand a conversation to your team whenever you want.

> [!NOTE]
>
> Customers can text photos and files. Your AI agent reads them and answers based on their content. Its own replies are text only. Your team can send attachments from the Helpdesk. See [Attachments](https://chatbase.co/docs/user-guides/chatbot/channels.md#attachments).

> [!NOTE]
>
> SMS uses the same Twilio connection as the [Phone](https://chatbase.co/docs/user-guides/integrations/twilio.md) channel. One number can take calls and texts on the same AI agent.

## Use cases

**Customer support by text.** Your AI agent answers from its [Data Sources](https://chatbase.co/docs/user-guides/chatbot/data-sources.md). When a customer needs a person, the [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action opens a ticket and uses the customer's number to identify them. It only asks for an email if your Escalations Action has an email field. The AI agent tells the customer that a teammate will reply in the same text conversation. Your team's replies arrive as texts, and closing the ticket hands the conversation back.

**One number for calls and texts.** Customers who call your Twilio number can text the same number. Import it on both the Phone and SMS channels of one AI agent.

## Before you start

* [Twilio connected](https://chatbase.co/docs/user-guides/integrations/twilio.md#how-to-connect-twilio) to the AI agent.
* A Twilio number that can send SMS.
* For US numbers, A2P 10DLC registration in Twilio. Carriers block texts from unregistered US numbers.
* The Basic plan or higher.
* A workspace without HIPAA compliance. SMS isn't available on [HIPAA-compliant](https://chatbase.co/docs/user-guides/workspace/hipaa-compliance.md) workspaces.

## How to connect SMS

**1. Open the SMS channel**

Navigate to your AI agent's **Channels** page, click **Manage** on the **SMS** card, and go to the **Connections** tab.

If Twilio isn't connected yet, click **Connect Twilio**. It opens the Twilio integration page, where you enter your Twilio credentials.

**2. Import numbers**

1. Click **Import a number**.
2. The **Import phone numbers** dialog lists the numbers in your Twilio account that can send SMS. Numbers already on this AI agent's SMS channel appear under **Already imported**.
3. Select the numbers you want. For each, you can set a **friendly name**, such as "Support line".
4. Click **Import selected**.

Imported numbers are on right away. Chatbase points each number's SMS webhook in Twilio at Chatbase and saves the number's previous SMS settings, so it can put them back if you delete the number.

> [!TIP]
>
> Text one of your imported numbers and confirm your AI agent replies.

> [!WARNING]
>
> A number that belongs to a Twilio Messaging Service only works if the service defers to the number's own webhook. Otherwise Twilio sends its texts to the service, and they never reach Chatbase.

## How texts work

* Each customer gets one conversation per number, shown in **Activity > Conversations** with the source **SMS**. The conversation's **Details** tab shows the **Customer number**.
* Customers often send several short texts in a row. The AI agent waits until 3 seconds after the latest text and answers them together.
* The AI agent keeps replies short and plain, because texts don't show formatting. A reply longer than 1,600 characters goes out as several texts.
* A text that contains only STOP, STOPALL, UNSUBSCRIBE, CANCEL, END, QUIT, REVOKE or OPTOUT gets no reply and isn't saved. Twilio's own opt-out handling then stops texts to that customer.
* Empty texts with no attachment are ignored.

Changes you save to instructions, Actions and channel settings go into a draft. Customers keep texting the live AI agent until you click **Publish**. See [Drafts and versions](https://chatbase.co/docs/user-guides/chatbot/versions.md).

## Turning a number off or deleting it

Each number on the **Connections** tab has a toggle and a menu.

**Turn it off** to stop the AI agent replying. Texts still arrive and show in **Activity > Conversations**, and open Helpdesk tickets keep working in both directions. Your team can still reply to customers who text while the number is off. Turn the toggle on again to bring the AI agent back.

**Delete it** to hand the number back. Click the menu icon (**⋯**), select **Delete**, and confirm in the **Delete phone number?** dialog. Chatbase puts back the number's previous SMS settings in Twilio, and texts stop reaching Chatbase. You can import the number again later.

> [!NOTE]
>
> The Phone and SMS channels share the number. Deleting it from the Phone channel, or removing it on the Twilio integration page, keeps texts working, and deleting it from SMS keeps calls working. [Disconnecting Twilio](https://chatbase.co/docs/user-guides/integrations/twilio.md#disconnect-twilio) deletes every SMS number on the AI agent and puts back their previous SMS settings.

## Human takeover

A teammate can [take over](https://chatbase.co/docs/user-guides/chatbot/help-desk/takeover.md) any SMS conversation from **Activity > Conversations**, or the AI agent opens a ticket through the [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action. While the ticket is open:

* The AI agent stops replying.
* The customer's texts, photos and files go to the ticket.
* Your team answers on the **SMS reply** tab. Replies go out as texts from the number the customer texted, with any attachments.
* Closing the ticket hands the conversation back to the AI agent.

If a reply can't be delivered, the message in the ticket shows **Message failed to send** with the reason:

* "This SMS didn't reach the customer." Twilio rejected the text, or Chatbase couldn't prepare it.
* "This number is no longer connected to this AI Agent, so the SMS wasn't sent." The number was deleted from SMS or moved to another AI agent.

## Limitations

* **One AI agent per number.** A number on another AI agent can't be imported, and the import shows "This number is already used by another AI Agent."
* **Basic plan or higher.** On other plans, turning a number on shows "SMS is available on the Basic plan or higher."
* **Not on HIPAA-compliant workspaces.** You can't turn SMS on in a HIPAA-compliant workspace, and you have to delete every SMS number before you turn HIPAA compliance on.
* **SMS tickets can't be merged** with other tickets in the Helpdesk.
* **The AI agent replies with text only.** Attachments go out only on Helpdesk replies.
* **No Send SMS Action in SMS chats.** The AI agent is already texting, so the [Send SMS](https://chatbase.co/docs/user-guides/chatbot/actions/send-sms.md) Action isn't offered on this channel.
* **Texts need Geo permissions.** Twilio only sends texts to countries turned on under **Messaging → Settings → Geo permissions** in the Twilio Console.
* **Twilio bills each text** on your Twilio account.

## Best practices

> [card] Give SMS its own instructions
>
> Turn off **Sync with global instructions** on the SMS channel's **Overview** tab to write instructions for texts only, such as a shorter tone. See [Instructions and global instructions](https://chatbase.co/docs/user-guides/chatbot/playground.md#instructions-and-global-instructions).

> [card] Turn off instead of deleting
>
> To pause the AI agent on a number, turn it off. Deleting hands the number back to its previous SMS settings, so customer texts stop reaching your Helpdesk.

## Troubleshooting

> [accordion] The AI agent doesn't reply to texts
>
> Check these in order:
>
> 1. The number's toggle is on in the SMS channel.
> 2. The conversation has no open Helpdesk ticket and isn't [paused](https://chatbase.co/docs/user-guides/chatbot/activity.md#pausing-a-conversation).
> 3. For US numbers, A2P 10DLC registration is complete in Twilio.
> 4. If the number is in a Twilio Messaging Service, the service defers to the number's webhook.
> 5. The customer's country is turned on in Twilio's **Geo permissions**.

> [accordion] A number is missing from the import dialog
>
> The dialog lists only numbers that can send SMS. If none of your numbers can, it shows "None of your Twilio numbers can send SMS." Numbers already on this AI agent's SMS channel appear under **Already imported**. A number used by another AI agent still appears, but importing it fails with "This number is already used by another AI Agent." Delete it from the other AI agent first.

> [accordion] My old SMS webhook stopped getting texts
>
> While the number is on Chatbase, Twilio sends its texts to Chatbase. Turning the number off doesn't change that. Delete the number from the SMS channel to put back its previous SMS settings.

> [accordion] A Helpdesk reply shows Message failed to send
>
> Read the reason under the message. If the number was deleted or moved to another AI agent, import it again on this AI agent. Otherwise check the message in your Twilio Console logs for Twilio's error.

## Frequently asked questions

> [accordion] Can one number take calls and texts?
>
> Yes, on the same AI agent. Import it on the [Phone](https://chatbase.co/docs/user-guides/integrations/twilio.md) channel for calls and on the SMS channel for texts.

> [accordion] What happens when a customer texts STOP?
>
> The AI agent doesn't reply and the text isn't saved. Twilio records the opt-out and stops texts to that customer from your number.

> [accordion] How many message credits does SMS use?
>
> Each reply uses message credits based on your AI agent's [model](https://chatbase.co/docs/user-guides/chatbot/models-comparison.md). A reply that triggers an Action costs twice that, and [attachments](https://chatbase.co/docs/user-guides/chatbot/channels.md#attachments) add credits per image or PDF page. Twilio bills each text separately.

## Next steps

> [card] [Twilio (Phone)](https://chatbase.co/docs/user-guides/integrations/twilio.md)
>
> Let the AI agent answer calls on the same numbers.

> [card] [Takeover](https://chatbase.co/docs/user-guides/chatbot/help-desk/takeover.md)
>
> Take over a conversation and reply yourself.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.