Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I grab and respond to specific SMS info being received?
    primarykey
    data
    text
    <p>Twilio has documentation/examples on how to respond to keywords in SMS messages for php (<a href="https://www.twilio.com/help/faq/sms/how-do-i-build-a-sms-keyword-response-application" rel="nofollow">https://www.twilio.com/help/faq/sms/how-do-i-build-a-sms-keyword-response-application</a>) and python (<a href="https://www.twilio.com/docs/quickstart/python/sms/replying-to-sms-messages" rel="nofollow">https://www.twilio.com/docs/quickstart/python/sms/replying-to-sms-messages</a>).</p> <p>What's the equivalent for grabbing the 'Request Parameters' using node.js? Because I'd like to be able to respond back using information received in the sms just like in the other examples. </p> <p>My current thinking is that my response should be something like:</p> <pre><code>var http = require('http'); var twilio = require('twilio'); http.createServer(function (req, res) { //Create TwiML response var twiml = new twilio.TwimlResponse(); twiml.message('Thanks, you said: ' + req.body + ' -- we received your message'); res.writeHead(200, {'Content-Type': 'text/xml'}); res.end(twiml.toString()); }).listen(8080); </code></pre> <p>But I'm getting an undefined message.</p> <p><em><strong></em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong> UPDATE <strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>****</strong> After incorporating @hexacyanide's info it works... the following returns all the request parameters (now I just need to parse them). Just thought I'd include this for anyone else that runs into the issue.</p> <pre><code>var http = require('http'); var twilio = require('twilio'); http.createServer(function (req, res) { var body = ''; req.on('data', function(data) { body += data; }); req.on('end', function() { //Create TwiML response var twiml = new twilio.TwimlResponse(); twiml.message('Thanks, your message of "' + body + '" was received!'); res.writeHead(200, {'Content-Type': 'text/xml'}); res.end(twiml.toString()); }); }).listen(8080); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload