back to features

Twilio Integration

Connect ChatBotKit bots to Twilio for SMS conversations and phone-call voice agents using your existing Twilio numbers.

ChatBotKit's Twilio integration lets your AI bots communicate through the channels customers already use: text messages and phone calls. Connect a Twilio number, choose the bot that should handle the conversation, and route inbound SMS or call webhooks into ChatBotKit.

The integration supports fast webhook replies when the model responds quickly, and it can use your Twilio Account SID and Auth Token for delayed SMS delivery when the response needs more time. For calls, ChatBotKit uses Twilio voice webhooks and TwiML to listen for speech, process the user's request, and speak the bot's response back to the caller.

What You Can Do

  • Receive SMS messages: Let customers text your Twilio number and get AI-generated replies.
  • Start SMS conversations: Initiate a model-authored SMS from the dashboard or API.
  • Handle phone calls: Route inbound calls to a ChatBotKit bot using Twilio voice webhooks.
  • Start phone calls: Initiate an outbound call with a model-authored opening message.
  • Preserve context: Keep SMS and call conversations tied to the caller for the configured session duration.
  • Tune voice output: Configure Twilio <Say> language and voice settings for spoken responses.

How It Works

For SMS, Twilio sends the inbound message to the ChatBotKit webhook. If the bot responds within the webhook window, ChatBotKit returns TwiML directly. If the model needs more time, the integration can send the reply later through the Twilio Messages API using the configured credentials.

For calls, Twilio sends call and speech events to the same webhook. ChatBotKit returns TwiML that gathers caller speech, queues the bot interaction, and speaks the generated response back with <Say>. The call flow keeps listening after each response so the caller can continue the conversation naturally.

Setup

To use the integration, create a Twilio integration in ChatBotKit, select the bot that should answer, and add your Twilio Account SID and Auth Token. Then copy the webhook URL into the Twilio Console for your phone number.

Use the messaging webhook for SMS and the voice webhook for calls. Both point to the same ChatBotKit webhook URL, while Twilio decides which payload it sends based on whether the interaction is a message or a call.

Practical Uses

Twilio works well for customer support, appointment scheduling, order updates, lead qualification, and phone-based assistants. SMS is best for short asynchronous exchanges, while calls are useful when customers need a hands-free or more immediate conversational experience.

For production use, keep bot responses concise, monitor Twilio usage costs, configure compliance and consent flows appropriate to your region, and test both SMS and call behavior with real Twilio numbers before sharing the channel publicly.