双向短信 - 发送/接收

发布于 2024-10-21 13:01:28 字数 245 浏览 10 评论 0原文

  1. 我想使用 SMS 网关发送接收 SMS 消息。

  2. 发送消息时,我将问一些问题,接收者应回复。

  3. 我需要在发送短信时添加一些唯一的id,并在接收时取回它。

我知道有一种方法可以做到这一点,例如 ICQ 和 Google vois 2 路短信。接收方将消息返回到同一号码,但只有发送方才能取回。

有人可以帮忙吗?

谢谢, 利奥尔

  1. I want to send receive SMS messages using SMS gateway.

  2. When sending message I am going to ask some question and reciever sould reply.

  3. I need to add some unique id when sending the SMS, and get it back when receiving.

I know there is a way to do that, like ICQ and Google vois 2 way sms. The receiver return the message to the same number, but only the sender get it back.

Can someone help with this?

Thanks,
Lior

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

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

发布评论

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

评论(1

似梦非梦 2024-10-28 13:01:28

几乎所有 SMS 网关都允许您发送和接收消息。发送消息的最常见方法是通过某种 HTTP API(SOAP、REST、RPC)。例如,要使用 Twilio(我工作的地方)发送消息,您可以使用以下命令向我们的 API 发出 POST 请求:三个参数:To(收件人)、From(您的 Twilio 号码)和 Body(消息中包含的内容)。许多其他网关也使用类似的方法。

由于全球短信系统的局限性,无法唯一标识消息。这意味着,除非消息的收件人手动包含标识符,否则除了匹配发件人和收件人的电话号码之外,无法将回复与原始消息关联起来。这可能会使处理单个收件人有多个未完成查询的情况变得棘手。您可以使用几种策略来绕过此限制。

  1. 请求唯一的响应令牌 - 对于发送给收件人的每个查询,要求响应对于该查询是唯一的。例如,在第一条消息中使用类似“要确认,用 A1 响应”的内容,并且在后续未完成的查询中使用不同的唯一响应。

  2. 使用不同的“发件人”电话号码 - 对于发送给收件人的每个查询,请从不同的号码发送。然后您可以将响应与响应的电话号码进行匹配。在许多情况下,这不是一个最佳系统,因为您需要更多电话号码,并且用户可能会收到来自许多不同号码的消息,从而导致混乱。

  3. 使未完成的查询过期 - 如果对每个查询的响应并不重要,则可以假设他们正在响应最近的查询,或者在响应后提示他们进行澄清。

关于接收消息,大多数网关会通过 HTTP 通知您。例如,当您的 Twilio 号码收到消息时,我们会向您使用 ToFromBody 包含参数。您可以像申请中的任何其他表单提交一样处理此问题。其他网关使用类似的方法,但我无法证明细节。

Almost all SMS gateways allow you to send and receive messages. The most common method for sending messages is via some sort of HTTP API (SOAP, REST, RPC). For example, to send a message using Twilio (where I work) you would make a POST request to our API with three parameters: To (the recipient), From (your Twilio number), and Body (what to include in the message). Many other gateways use similar methods.

Due to limitations of the SMS system worldwide, there is no way to uniquely identify messages. This means that unless the recipient of a message manually includes an identifier there is no way to associate a reply with the original message outside of matching the sender and recipients phone numbers. This can make it tricky to handle cases where there are multiple outstanding queries to a single recipient. There are a couple strategies you can use to get around this limitation.

  1. Request unique response tokens - For each query sent to a recipient, require the response to be unique to that query. For instance, on the first message use something like, "To confirm, respond with A1" and on subsequent outstanding queries use a different unique response.

  2. Use different 'From' phone numbers - For each query sent to a recipient, send from a different number. Then you can match the response to the phone number responded to. This is not an optimal system in many cases since you need more phone numbers and users could receive messages from many different numbers resulting in confusion.

  3. Expire outstanding queries - If responses to each query aren't important, just assume they're responding to the most recent, or prompt them for clarification after a response.

In regards to receiving messages, most gateways will notify you via HTTP. As an example, when a message comes into your Twilio number, we make a POST request to a URL that you specify with the To, From and Body parameters included. You handle this like any other form submission in your application. Other gateways use similar methods, but I can't attest to the details.

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