Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio: How to map an SMS reply to an original SMS

Tags:

twilio

Im creating an web app that uses twilio and I seem to have a problem.

The system consist of 3 actors:

  • A physical customer
  • A physical server
  • Our web application

Whenever a client creates a new "job" via a form, all of the job details will be sent in a text to many different servers. When any one of the servers reply to that text message, we need to be able to associate his reply with the particular "job" he replied to. The problem is I can't figure out how to do this without buying a number for each job and just associating each number with a job. If possible i would only like to use one number, since buying thousands of number is completely wasteful and impossible.

like image 418
user2158382 Avatar asked Apr 25 '13 00:04

user2158382


People also ask

Can you reply to a Twilio message?

When you send an SMS message to your Twilio phone number, Twilio will send a webhook, an HTTP request with all the details about the message, to a URL you associate with that number. You can reply to the message by responding to the webhook with TwiML (Twilio Markup Language).

What is two way SMS Twilio?

Twilio two-way SMS and MMS messages allow you to carry on a conversation by both sending and receiving text and multimedia messages. This can enable a contact center agent to engage in an SMS-based chat with a customer, or let customers re-schedule appointments via text and receive automated responses.

Can I send SMS to any number using Twilio?

Twilio Phone Numbers and Hosted SMS numbersAny SMS-enabled Twilio phone number or Hosted SMS number on your account can be used to send SMS messages. To use a phone number for sending messages, input your phone number in the From parameter of your API request using E. 164 formatting.


1 Answers

Cookies are the best way to handle a conversation, but because you cannot tell which text message the server replies to, it can be tricky. If you send the server 2 jobs, and they choose to reply to the first job, you have no way of knowing this.

I think you have two sensible ways of doing this:

  • Give each job a reference code (2 or 3 digits to make it easy) that the server can reply with. This is the most reliable way to do it.
  • Use multiple - but not many - phone numbers. So that during a period of one day, or a few hours, you only send a server one job per number. Then you can recycle the pool of numbers and reuse them after the job has 'timed out'. This rather depends on what your expect volumes are.
like image 121
xmjw Avatar answered Sep 29 '22 01:09

xmjw