Skip to content

Instantly share code, notes, and snippets.

View AlexLakatos's full-sized avatar
🥑
Developer Avocado

Alex Lakatos AlexLakatos

🥑
Developer Avocado
View GitHub Profile
let text = "👋Hello from Nexmo";
nexmo.channel.send(
{ "type": "sms", "number": "TO_NUMBER" },
{ "type": "sms", "number": "Nexmo" },
{
"content": {
"type": "text",
"text": text
}
const app = require('express')()
const bodyParser = require('body-parser')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
app.listen(3000)
app.post('/webhooks/inbound-message', (req, res) => {
console.log(req.body);
res.status(200).end();
});
@AlexLakatos
AlexLakatos / azure-receive-sms-webhook.js
Created January 30, 2020 15:17
Receive SMS Webhook - Azure Function
module.exports = async function(context, req) {
const params = Object.assign(req.query, req.body);
if (params.text) {
context.log("SMS received", params);
}
context.res = {};
};
@AlexLakatos
AlexLakatos / azure-send-receive-sms-webhook.js
Created January 30, 2020 15:20
Azure Send Receive SMS Function
module.exports = async function(context, req) {
const Nexmo = require("nexmo");
const nexmo = new Nexmo({
apiKey: process.env["NEXMO_API_KEY"],
apiSecret: process.env["NEXMO_API_SECRET"]
});
const params = Object.assign(req.query, req.body);