简体   繁体   English

C# - 上下文短信回复

[英]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.我需要一些帮助来完成一个简单的任务,我正在编写一个应用程序,它将向用户(患者)发送短信,询问他们是否要重新填写处方,如果他们回复 Y(是),那么我们将重新填写处方,如果他们回答 N(否),那么我们不会,问题是,如果有多个处方需要补充,并且因为有一个用户和一个电话号码 (Twilio) 和一个用户电话号码和 2- 3 个处方,我如何确定用户对哪个处方做出了 Y 的反应,而对哪个处方做出了 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在 SMS 中发送唯一标识符并要求用户回复相同的内容,以便我可以识别处方

  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.维护一个队列,一次只发送一条短信,这样我可以很容易地识别出哪个处方,但是这是一个很大的问题,如果用户没有回复,那么我的应用程序将永远不会发送短信其他处方或我应该等待多长时间才能收到回复,直到我为其他处方发送 SMS 并再次为前一个处方发送 SMS。

Twilio developer evangelist here. Twilio 开发人员布道师在这里。

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.您只需要与患者的最大处方数量一样多的电话号码,因此虽然会增加成本,但不会增加那么多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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