如何使用唯一的标识符跟踪Twilio中的消息收件人?

发布于 2025-01-30 02:22:32 字数 315 浏览 3 评论 0原文

我目前正在使用Twilio向某人发送文本,此人/电话号码与后端的数据对象相关联。创建对象时,此文本将带有问题。

我已经为Twilio编号设置了一个Webhook,因此当它收到消息时,它将达到我在服务器上设置的端点。我想根据用户的响应更改对象。

但是,我无法找到一种将与初始对象相对应的文本与我收到的响应收到的文本/对象相关的文本的方法。这些消息具有ID,但是每个消息都是独特的,它们并不是每个“对话”或电话号码所唯一的,因此在这种情况下它们对我没有用。

有办法这样做吗?后端数据对象在它们上具有唯一的ID,但是我看不到将其传递给它的方法,以便在获得响应文本后以后可以访问它。

I am currently using Twilio to send someone a text, this person/phone number is associated with a data object on the backend. When the object is created, this text is sent out with a question.

I have setup a webhook for the Twilio number so that when it receives a message, it will hit an endpoint I have setup on my server. I would like to alter the object based on the user's response.

However I cannot figure out a way to associate the text sent that corresponds with the initial object, to the text/object that I receive as a response. The messages have ID's, but those are unique to each message, they are not unique to each 'conversation' or phone number, so they are not useful for me in this scenario.

Is there a way to do this? The backend data objects have a unique ID on them, but I don't see a way to pass this around so that I can access it later once I get a response text.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤者何惧 2025-02-06 02:22:32

SMS是无状态的,因此跟踪会话的唯一方法是使用唯一的数字来发送消息,该消息是不现实的。

您只需要一次发送一条消息,并等待响应,其中一些内置的超时内置,然后确定下一步要做什么,发送相同的消息或发送下一条消息。

另一种方法是让他们参考一些您可以在响应主体中寻找的值,以将响应与请求匹配。

SMS is stateless, so the only way to keep track of a session is to use a unique number to send the message from which isn’t realistic.

You will need to send only one message out at a time and await a response with some built in timeout on your side and then decide what to do next, send the same message or send the next message.

Another way is have them reference some value you can look for in the response body to match the response with the request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文