Created
September 7, 2018 18:14
-
-
Save kwhinnery/32aad8caada5a17f8c77340b29174252 to your computer and use it in GitHub Desktop.
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 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) |
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 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