blob: 9067aa6df528ef436d23766d9edbadc6829ee403 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
const bodyParser = require('body-parser');
const express = require('express');
const { MessagingResponse } = require('twilio').twiml;
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/sms', (req, res) => {
/** @type {string} */
const body = req.body;
const twiml = new MessagingResponse();
twiml.message(JSON.stringify(body));
res.type('text/xml').send(twiml.toString());
});
app.listen(3000, () => {
console.log('Express server listening on port 3000');
});
|