Created
November 10, 2017 08:23
-
-
Save dstotijn/fb6d8b46e5f97b68dbc70f5c25ee4bd0 to your computer and use it in GitHub Desktop.
Web server that logs incoming SMS message callbacks from MessageBird
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require("express")(); | |
const bodyParser = require("body-parser"); | |
const port = process.env.PORT || 3000; | |
app.use(bodyParser.urlencoded({ extended: true })); | |
/** | |
* @see https://developers.messagebird.com/docs/messaging#messaging-receive | |
*/ | |
app.post("/", (req, res) => { | |
console.log({ | |
id: req.body.id, | |
recipient: req.body.recipient, | |
originator: req.body.originator, | |
body: req.body.body, | |
createdDatetime: req.body.createdDatetime | |
}); | |
res.send("OK"); | |
}); | |
app.listen(port, () => | |
console.log(`Server running on http://localhost:${port}`) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "messagebird-callbacks-node", | |
"version": "1.0.0", | |
"description": | |
"Web server that logs incoming SMS message callbacks from MessageBird.", | |
"main": "index.js", | |
"scripts": { | |
"start": "node index.js" | |
}, | |
"author": "David Stotijn <david@messagebird.com>", | |
"license": "MIT", | |
"dependencies": { | |
"body-parser": "^1.18.2", | |
"express": "^4.16.2" | |
}, | |
"devDependencies": { | |
"prettier": "^1.8.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment