Twilio:如何将短信回复映射到原始短信 [英] Twilio: How to map an SMS reply to an original SMS

查看:32
本文介绍了Twilio:如何将短信回复映射到原始短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个使用 twilio 的网络应用程序,但我似乎遇到了问题.

Im creating an web app that uses twilio and I seem to have a problem.

该系统由 3 个参与者组成:

The system consist of 3 actors:

  • 实体客户
  • 一台物理服务器
  • 我们的网络应用程序

每当客户端通过表单创建新的作业"时,所有作业详细信息都将以文本形式发送到许多不同的服务器.当任何一台服务器回复该文本消息时,我们需要能够将他的回复与他回复的特定工作"相关联.问题是如果不为每个工作购买一个数字并且只是将每个数字与一个工作相关联,我无法弄清楚如何做到这一点.如果可能的话,我只想用一个号码,因为购买数千个号码是完全浪费和不可能的.

Whenever a client creates a new "job" via a form, all of the job details will be sent in a text to many different servers. When any one of the servers reply to that text message, we need to be able to associate his reply with the particular "job" he replied to. The problem is I can't figure out how to do this without buying a number for each job and just associating each number with a job. If possible i would only like to use one number, since buying thousands of number is completely wasteful and impossible.

推荐答案

Cookie 是处理对话的最佳方式,但由于您无法分辨服务器回复的是哪条短信,因此可能会很棘手.如果您向服务器发送 2 个作业,而他们选择回复第一个作业,则您无法知道这一点.

Cookies are the best way to handle a conversation, but because you cannot tell which text message the server replies to, it can be tricky. If you send the server 2 jobs, and they choose to reply to the first job, you have no way of knowing this.

我认为您有两种明智的做法:

I think you have two sensible ways of doing this:

  • 为每项工作提供一个参考代码(2 或 3 位数字以使其更容易),服务器可以使用该代码进行回复.这是最可靠的方法.
  • 使用多个(但不是很多)电话号码.因此,在一天或几个小时内,每个号码只能向服务器发送一个作业.然后,您可以回收号码池并在作业超时"后重新使用它们.这更取决于您的预期交易量.

这篇关于Twilio:如何将短信回复映射到原始短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆