Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

node.js - twilio receive sms without responding back

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Those who are finding this in 2021,

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...