twilio multiple simultaneous conversations per user
Here's an example:
Every time a user sells a car, he has to reply to my system to say what the color of the car is that he sold (my system knows th开发者_JAVA百科at a car was sold and what its make is but not what color it was).
If the user sells only 1 car at a time and texts back immediately, I can remember which car he is talking about by storing information about the current_car in a session variable. If, on the other hand, the user sells 3 cars simultaneously, I can't store a current_car session variable because there are 3 current cars.
How do I know which car the user is talking about when he replies to my text? Is there any way to embed a unique token in the text message I send so that the reply references the correct car out of the 3 cars?
Twilio API doesn't support that. Have you noticed what Twitter does for the same precise use-case? They include in the original SMS instructions such as "reply directly with ....". The user would have to type that in so keep it simple.
Alternatively, you can reply to the ambiguous messages with "There were three cars. Which sold? (reply with number 1, 2, or 3)"
精彩评论