Using conversations to build chat to SMS app

I have a use case where I want end users to enter messages via a web page, and those messages will be sent to one of our agents via SMS. The agent will reply via SMS and the end user will see the reply on the website. I have got it working with one end user and one agent. The problem is that I need to connect multiple end users to a single agent.

I am using Twilio Conversations and have added the agent as a participant to the conversation using the agent's personal cell phone number and our Twilio number. I am using the conversation SID to track the conversation between the end user and the agent. There can only be one conversation between our Twilio number and the agent's personal cell phone number, however, so if another end user initiates a chat with that same agent, how do I track the 2nd, 3rd, 10th, 1000th conversation? Our site could have millions of users so getting a different Twilio number for each end-user is not feasible.

Any suggestions?


  • When you have one agent, you are very limited by SMS because of the issues you raise. SMS has no threading, or replies to specific messages, so to you use SMS like this you would need a new Twilio phone number for each active conversation the agent was in. Your site may potentially have millions of users, but I would expect the number of active conversations would be lower than your total users, so you could build a pool of numbers that allow you to swap different conversations in.

    Alternatively, you could consider building a web application for your agents, that allow them to respond to messages without the need for a phone number. You could notify agents that they have a new message using an SMS or push notification, but they could send their responses through a web or native application. That way they could have multiple threads going at the same time and you don't need to handle multiple numbers.

    This actually sounds like the intention behind Twilio Frontline. Frontline is an application that provides your agents with a way to communicate with your users over different messaging channels, including SMS, WhatsApp and web chat.

If this is an emergency, please contact Twilio Support. This is not an official Support channel.
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support