twilio receive sms without responding back

一笑奈何 提交于 2019-12-11 15:07:22

问题


Good Day,

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

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.

my code is

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

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


回答1:


I have not tried yet but I think if you comment out this line:

// resp.message("<Response></Response>");

no message will be sent.


Update after reading Phil's comment:

This: resp.message('<Response></Response>');

is equivalent with sending the folowing XML to Twilio:

<Response>
  <Response></Response>
</Response>

in which case the sender will receive a message like: <Response></Response>

If you comment out the line

// resp.message("<Response></Response>");

or if you do resp.message("");

is equivalent with sending the folowing XML to Twilio:

<Response />

in which case no message will be sent to the sender.



来源:https://stackoverflow.com/questions/47443473/twilio-receive-sms-without-responding-back

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!