Twilio:将收到的短信转发到 URL [英] Twilio: Forward received SMS to URL

查看:48
本文介绍了Twilio:将收到的短信转发到 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向我的 Twilio 号码发送短信,并在收到后将其转发 (POST/GET) 到我的 URL.

I want to send a SMS to my Twilio number and on receipt to forward it (POST/GET) to my URL.

我不想每分钟检查 Twilio 是否有新消息,因为它们真的很少(每天最多 20 条短信)并且以随机间隔发送,因此汇集似乎是一种资源浪费,我也需要立即采取行动在收到消息时,如果这样做,我将不得不间隔最多 1 分钟.

I would not like to be checking Twilio for new messages each minute as they are really few (20 SMS a day at max) and sent at random intervals so pooling seems like a waste of resources, also I need to take action inmediatly on message received so I would have to have an interval of max 1min if doing it this way.

因此,如果 Twilio 可以将收到的短信推送"到某个 URL,那就太好了.

so if Twilio could "push" the SMS on receipt to some URL, it would be great.

我如何使用 Twilio 完成此任务?

How could I accomplish this with Twilio?

谢谢

推荐答案

Twilio 布道者在这里.

Twilio evangelist here.

好消息!Twilio 实际上完全按照您想要的方式工作.当有人向您的 Twilio 号码发送入站 SMS 时,我们使用称为 webhook 的东西让您知道,并且配置该 webhook 非常容易.如果您登录 Twilio 仪表板并单击号码"选项卡,您将看到您的 Twilio 电话号码:

Good news! Twilio actually works exactly the way you want. We use something called a webhook to let you know when someone sends an inbound SMS to your Twilio number, and its really easy to configure that webhook. If you log into your Twilio dashboard and click on the Numbers tab you will see your Twilio phone number:

现在点击该电话号码以转到该号码的配置页面.

Now click on that phone number to go to the configuration page for than number.

在该页面上,您将看到两个输入字段,一个标记为语音请求 URL,另一个标记为消息请求 URL.当有人拨打语音电话或向您的 Twilio 号码发送短信时,这两个值可让您告诉 Twilio 您希望我们请求什么 URL.如果您只关心入站 SMS 消息,那么您只需在 Message Request URL 字段中输入一个 URL.

On that page you will see two input fields, one labeled Voice Request URL and the other labeled Message Request URL. These two values let you tell Twilio what URL you want us to request when someone either makes a voice call or sends an SMS to your Twilio number. If you only care about inbound SMS messages, then you only need to put a URL in the Message Request URL field.

一旦您填写了 SMS 消息 URL,您只需要编写一个位于 URL 的网页.该网页还可以检索 Twilio 向其发出请求时发送的一组参数.

Once you've filled in the SMS Message URL you just need to write a webpage that lives at URL. That webpage can also retrieve a set of parameters that Twilio sends when it makes it request to it.

希望有所帮助.

这篇关于Twilio:将收到的短信转发到 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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