Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2020
What would you like to do?
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const app = express();
app.use(bodyParser.urlencoded({ extended: false });'/sms', (req, res) => {
const twiml = new MessagingResponse();
// Here is the from number and message body
const message = twiml.message();
message.body('The Robots are coming! Head for the hills!');'');
res.writeHead(200, {'Content-Type': 'text/xml'});
http.createServer(app).listen(1337, () => {
console.log('Express server listening on port 1337');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment