Search code examples
smstwiliosurvey

How to match incoming SMS to outgoing message when running multiple surveys to the same phone number using Twilio and node.js


I'm just getting a little bit into node.js and thought doing a survey using Twilio would be good learning proof of concept.

I am aiming to send questions along the lines of "What did you think of xxx service? (on a scale of 1=best 10-worst)"

For one survey, I've got this up and running and I can match up the incoming From mobile number to the question in my database and update responses accordingly. This works well

However, I want to take it a step further and run concurrent surveys to the same phone number - lets say 3 outgoing SMS sent to one phone number. In this case matching up the From number would not work as I would not know which question to put the response against.

I can't work out how I would match each response back to the original question. My original thought was the message SID but that seems to change.

Can anyone help me out?


Solution

  • Twilio evangelist here.

    The easiest solution here would be to assign each survey a different Twilio phone number. This wold let you track the unique From/To phone number pair evn if you are sending multiple surveys to one recipient.

    Hope that helps.