# "How to Connect TwiML Rest API to On-Chat"

> "On-Chat integrates with TwiML Rest API so your team can receive and respond to inbound SMS from Twilio-powered numbers in a centralized inbox with routing, automation, and conversation tracking."

URL: https://on-chat.live/guides/integrations/how-to-connect-twiml-rest-api-to-on-chat/
Last updated: 2026-11-14

## What is TwiML Rest API?
TwiML (Twilio Markup Language) Rest API is Twilio's programmable messaging interface that allows developers to control how SMS messages are sent, received, and responded to using XML-based instructions. By integrating the TwiML Rest API channel with On-Chat, support teams can receive inbound SMS through Twilio-powered numbers, manage conversations in a shared inbox, and leverage On-Chat's routing and automation features for structured, responsive customer support.


## Prerequisites
- An active Twilio account with a phone number enabled for SMS
- Twilio Account SID and Auth Token from the Twilio console
- Basic understanding of TwiML and Twilio webhooks
- On-Chat account with admin access
- Ability to configure the SMS webhook URL on your Twilio phone number

## Step 1: Retrieve Your Twilio Account SID and Auth Token
Log in to the Twilio console at console.twilio.com. On the dashboard, copy your **Account SID** and **Auth Token**. These are used to authenticate On-Chat's API requests to Twilio. Keep these credentials secure and do not share them publicly.

## Step 2: Identify Your Twilio Phone Number
In the Twilio console, go to **Phone Numbers** → **Manage** → **Active Numbers** and select the number you want to use for SMS customer support. Note the full E.164 formatted number. Confirm the number has the SMS capability enabled.

## Step 3: Create a TwiML SMS Inbox in On-Chat
In On-Chat, go to **Settings** → **Inboxes** → **New Inbox** and select **SMS**. Choose **TwiML Rest API** as the provider. Enter your Twilio Account SID, Auth Token, and phone number. Save the inbox — On-Chat will generate the inbound webhook URL for your Twilio number.

## Step 4: Configure the Webhook URL in Twilio
In the Twilio console, navigate to your phone number's configuration. Under **Messaging**, set the **A Message Comes In** webhook URL to the On-Chat webhook URL you generated. Set the method to HTTP POST. Save the configuration. Twilio will now forward all inbound SMS to On-Chat.

## Step 5: Add Agents and Configure Routing
In On-Chat, go to **Settings** → **Inboxes** → select your TwiML inbox → **Collaborators**. Add agents to handle SMS conversations. Enable auto-assignment to route new conversations to available agents based on workload or round-robin distribution.

## Step 6: Test the Full Message Flow
Send a test SMS to your Twilio number. Confirm it appears as a new conversation in On-Chat. Reply from an agent and verify the customer receives the outbound SMS via Twilio. Review Twilio's message logs and On-Chat's conversation history to confirm everything is working end-to-end.

## Best Practices
- Use On-Chat automation to send immediate auto-acknowledgment messages when customers first contact via your Twilio TwiML number
- Monitor Twilio's message delivery logs to track outbound SMS success and troubleshoot failed deliveries
- Apply On-Chat conversation labels to categorize TwiML SMS issues by type, region, or product
- Use Twilio's error webhooks to alert your team when SMS delivery fails so no customer message is missed

## Keep reading

- ["How to Connect an Android Phone to On-Chat"](https://on-chat.live/guides/integrations/how-to-connect-an-android-phone-to-on-chat/): "Connect an Android phone with a local SIM card to On-Chat to send and receive SMS for your contacts. One phone covers a country's message volume."
- ["How to Connect ArabiaCell SMS to On-Chat"](https://on-chat.live/guides/integrations/how-to-connect-arabiacell-sms-to-on-chat/): "Connect ArabiaCell SMS to On-Chat and manage SMS conversations from Gulf region customers in a shared team inbox."
- ["How to Set Up On-Chat Custom Voice Channel"](https://on-chat.live/guides/integrations/how-to-set-up-on-chat-custom-voice-channel/): "Set up On-Chat Custom Voice channel to handle inbound and outbound voice calls in your customer support inbox."
