Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Created September 7, 2018 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/32aad8caada5a17f8c77340b29174252 to your computer and use it in GitHub Desktop.
Save kwhinnery/32aad8caada5a17f8c77340b29174252 to your computer and use it in GitHub Desktop.
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