Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created Sep 7, 2018
Embed
What would you like to do?
const express = require('express')
const app = express()
app.post('/sms', (request, response) => {
let twiml = `
<Response>
<Message>hey there, thanks for checking out my demo!</Message>
</Response>
`;
response.type('text/xml')
response.send(twiml)
})
app.post('/call', (request, response) => {
let twiml = `
<Response>
<Dial>
<Conference>mlh</Conference>
</Dial>
</Response>
`;
response.type('text/xml')
response.send(twiml)
})
app.listen(3000)
const twilio = require('twilio')
let client = twilio()
client.messages.list({ to: '(415) 881-1720'}, (err, messages) => {
messages.forEach((message) => {
client.calls.create({
from: '(415) 881-1720',
to: message.from,
url: 'https://kevin.ngrok.io/call'
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment