简体   繁体   中英

C# - Contextual SMS Replies

I need some help doing a simple task, I'm writing an app, that will send out SMS to the user (patient), asking if they want their prescription refilled, if they reply Y (Yes) then we will refill the prescription, if they reply N (No) then we will not, the issue is, what if there is more than one prescription that needs refilling and since there is ONE user and ONE phone-number (Twilio) and ONE user phone-number and 2-3 prescriptions, how can I identify which prescription did the user respond to with Y and to which with N.

I came up with 2 possible solutions;

  1. Send unique-identifier in the SMS and ask the user to respond back with the same so that I can identify the prescription

  2. Maintain a queue, and only send out ONE SMS at a time, this way I can easily identify which prescription, but and it is a BIG BUT, what if the user did not reply, then my app will never send out an SMS for the other prescriptions or how long should I wait for the reply until I send out an SMS for the other prescription and send an SMS again for the previous one.

Twilio developer evangelist here.

Your two solutions are a start, but each has their issues. Getting a user to send an identifier back is a difficult ask and you identified the problem with waiting for a response that might not come.

One final alternative is to use multiple phone numbers, one per prescription. That way you can tell which prescription was being replied to without requiring the user include an identifier, but without requiring a queue as well. You only need as many phone numbers as the maximum number of prescriptions for a patient, so while it would increase the cost, it wouldn't be by that much.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM