"getting-started"

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

"Connect TwiML Rest API to On-Chat and handle two-way SMS conversations in a shared inbox using Twilio's TwiML programmable messaging interface with automation a"

Introduction

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.

SEO Keywords: TwiML Rest API On-Chat integration, TwiML SMS helpdesk, Twilio TwiML On-Chat, programmable SMS support On-Chat, TwiML webhook On-Chat, two-way SMS TwiML On-Chat, Twilio SMS inbox

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

Build your first dynamic flow today

30 days free. No credit card. Set up in minutes.

Create your free account