Twilio: how to match SMS reply to original SMS

I am building a web application using twilio and I seem to have a problem.

The system consists of three participants:

  • Physical client
  • Physical server
  • Our web application

Whenever the client creates a new "task" through the form, all the details of the task will be sent in text to different servers. When any of the servers responds to this text message, we must be able to associate his response with the specific “work” to which he replied. The problem is that I can’t figure out how to do this without buying a number for each job and simply linking each number to the task. If possible, I would like to use only one number, as buying thousands of numbers is completely wasteful and impossible.

+5
source share
3 answers

Cookies are the best way to handle conversations , but since you cannot determine which text message the server is responding to, it can be difficult. If you send jobs to server 2, and they prefer to answer the first job, you may not know.

I think you have two reasonable ways to do this:

  • Give each task a reference code (2 or 3 digits to simplify), to which the server can respond. This is the most reliable way to do this.
  • Use a few, but not many, phone numbers. So that within one day or several hours you send only one server task to a number. Then you can recycle the pool of numbers and reuse them after the timeout. It rather depends on your expected volumes.
+8

Twilio, cookie:

http://www.twilio.com/docs/quickstart/php/sms/tracking-conversations

-, cookie , Twilio , , . Twilio SMS "" - cookie "To/From number number". , cookie , 415-555-2222 415-555-1111, cookie, 415-555-3333 415-555-1111.

+5

, , @xmjw

How users can send text messages to each other on Twilio

Although the application is different, the concept is the same. For anyone who might stumble upon this issue and need other solutions.

As a result, I decided to create unique response codes. Then, in response, I could request a response code and a number from the number to associate it with the source text. However, in my case, it was a man on both sides. In order for one side to be automated as a server, you could analyze the text for the code, and then return with this code. Then you are simple SELECT * FROM messages WHERE code = ?.

+1
source

All Articles