简体   繁体   English

跟踪从不同服务器会话到一个号码的对话链

[英]Track conversation chain from different server sessions to one number

I'm creating an app which will allow all users to initiate conversation with page owner using Chat-to-SMS service. 我正在创建一个应用程序,该应用程序将允许所有用户使用“聊天到短信”服务与页面所有者发起对话。

Problem is that I'm not sure how to track conversations since there would be one conversation chain from SMS Provider <-> page owner. 问题是我不确定如何跟踪对话,因为SMS提供商<->页面所有者会有一个对话链。 When owner clicks reply, it needs to know which session user it needs to send the message to. 当所有者单击答复时,它需要知道向其发送消息的会话用户。

Basically, I need to do opposite what is being explained here: https://www.twilio.com/docs/quickstart/php/sms/tracking-conversations 基本上,我需要做相反的解释: https : //www.twilio.com/docs/quickstart/php/sms/tracking-conversations

How should I accomplish this? 我应该如何做到这一点? I can't quite wrap my head around this. 我无法完全解决这个问题。

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

If you are sending all the chat messages to just one SMS number then there is no easy way to tie replies back to the original message. 如果您仅将所有聊天消息发送到一个SMS号码,则没有简单的方法将回复绑定到原始消息。 (As a quick experiment, if you open an SMS conversation in your own phone and try to reply to any message that wasn't the latest one, you'll see it's not possible.) (作为一项快速实验,如果您用自己的手机打开一个SMS对话,然后尝试回复不是最新消息的任何消息,您将发现它是不可能的。)

There are workarounds though. 虽然有解决方法。

You could, when forwarding the message, generate an ID for it. 您可以在转发消息时为其生成ID。 Then get your page owner to include that ID when responding to that message, that way you can route the message back to the original sender and strip out the ID. 然后,让页面所有者在响应该消息时包括该ID,这样您就可以将消息路由回原始发件人并删除该ID。

Alternatively, when replying you could always respond to the last message that came in. This relies on there not being much traffic, allowing the page owner to respond before the next message arrives. 或者,在回复时,您始终可以响应上一条消息。这依赖于通信量不大,允许页面所有者在下一条消息到达之前进行响应。 This is error prone though. 但是,这容易出错。

Another alternative is purchasing a new number for each new conversation. 另一种选择是为每个新对话购买一个新号码。 You could expire the number after a predetermined amount of time. 您可以在预定的时间后使数字过期。 This is made much easier with Twilio Proxy , which was announced recently and is currently in preview. 最近宣布的Twilio Proxy (现在处于预览状态)使此操作变得更加容易。

Let me know if that helps at all. 让我知道是否有帮助。

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

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