twilio 收到短信没有回复 [英] twilio receive sms without responding back

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

问题描述

美好的一天,

如何在不回复发件人的情况下使用 twilio 在我的网络应用程序上正确接收短信.

How do I properly receive an SMS on my web app using twilio without responding back to the sender.

我读过这个.. https://support.twilio.com/hc/en-us/articles/223134127-Receive-SMS-messages-without-Responding 但我也需要使用网络钩子将短信发送到我的网络应用程序,如果我在没有设置响应的情况下收到它,它将生成一个错误 - 11200(HTTP 检索失败)我该如何防止?也可以通过设置响应.

I read about this.. https://support.twilio.com/hc/en-us/articles/223134127-Receive-SMS-messages-without-Responding but I need to use the webhook to send the sms to my webapplication too, if I do receive it without setting a response, It will generate an Error - 11200 (HTTP retrieval failure) how do I prevent this? also by setting up respones.

我的代码是

var resp = new twilio.twiml.MessagingResponse();
resp.message('<Response></Response>');
                      res.writeHead(200, {
                        'Content-Type':'text/xml'
                      });
                      res.end(resp.toString());

可悲的是,这个将 发送给发件人......顺便说一下,我正在使用 nodejs.. 谢谢!

sadly this one sends <Response></Response> to the sender instead.. im using nodejs by the way.. Thanks!

推荐答案

那些在 2021 年发现这个问题的人,

Those who are finding this in 2021,

如果您只需要从 twilio 接收消息而不向用户发送任何消息,那么您可以使用此代码.

If you need to just recieve message from twilio and not send any message to user then you can use this code.

res.writeHead(200, {'Content-Type': 'text/plain'});
res.end();

有关更多信息,请参阅此文档,接收短信和彩信没有回复的消息

For more refer this doc, Receive SMS and MMS Messages without Responding

这篇关于twilio 收到短信没有回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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