The following code works fine, I've tested with nGrok running locally.
Two of the requirements I have left and can't figure out are:
- Capture the phone number of the sender (put in variable)
- Capture the body of the text the sender sent (put in variable)
Many thanks in advance!
const express = require('express');
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const app = express();
});
app.post('/sms', (req, res) => {
// Start our TwiML response.
const twiml = new MessagingResponse();
// Add a text message.
const msg = twiml.message('some canned response');
res.writeHead(200, {'Content-Type': 'text/xml'});
res.end(twiml.toString());
});
app.listen(3000, () => {
console.log('Example app listening on port 3000!');
});