The Twilight Evangelist is here.
This is actually a bit complicated, but you have several options. The main problem is that you need to send SMS messages from the Twilio number to the consultant, but this can contain several conversations. Twilio will store session / cookies, etc. , but only unique to two numbers. Since SMS does not have anything that allows you to add any additional metadata, so you need to look at several workarounds.
The main problem here is really UX - if the consultant receives SMS from the actual client number and answers via SMS, the SMS is sent to the client, not Twilio. At this point, the consultant “leaked” to his direct mobile number.
Skip the message flow with one client:
The client sends an SMS to the Twilio proxy number:
Customer -> Twilio Number -> Consultant
The consultant then answers the Twilio number and he is forwarded to:
Consultant -> Twilio Number -> Customer
This is normal. A conversation can be made on the consultants phone number Twilio. When the consultant answers, your application simply acts as a proxy server and sends the message to the client.
When you add a second client, it is very difficult for a consultant to know who the message is from. Because they both come from the same Twilio number from the point of view of consultants!
Customer1 -> Twilio Number -> Consultant Customer2 -> Twilio Number -> Consultant
Then to answer:
Consultant -> Twilio Number -> ??
When the consultant answers, to which client do you send the message? And what kind of conversation does he answer? There are several options:
1 Multiple rooms
Use one number for the client to send to the SMS consultant, but several different numbers, like the number when sending to the client. Thus, clients have only one number, but the consultant has many different numbers, one for each client. This can be a little expensive if the consultant has hundreds of clients, even 1 month / each!
2 PIN
The prefix of each SMS with the contact number that identifies the customer. So <ID> <Message> . Then, when the consultant answers, they indicate the <ID> in the conversation to which they respond. However, this is not the best user interface, and will make the next stream of messages a bit complicated.
3 App
This is my favorite solution, but requires a bit more work. Create a web or mobile app for them that uses push notifications to connect between your device and Twilio. This allows you to easily transfer conversations to the original From / To number, rather than adding additional data to the proxy server. It also allows the consultant to keep the number of clients, as he may be given a business card with a mobile number on it, and an SMS message may suggest that he added this number to his phone. It also means that he could access these SMS messages from anywhere, he is no longer tied to his own phone! It can work on tablet / laptop / desktop / any other!
This is a rather difficult problem to work with, simply because SMS is stateless. Twilio keeps state, but it is unique only for each pair of numbers, one pair (from / to) cannot have several session states.
Hope this helps!