Created
August 30, 2015 18:32
-
-
Save billinghamj/8f66fa91acb79f790a97 to your computer and use it in GitHub Desktop.
Twilio async/await
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 twilio = require('twilio'); | |
const app = express(); | |
app.use('/twilio', twilio.middleware); | |
const call = await twilio.call.create('+12125551234', { from: '+16465551234' }); | |
call.say('Welcome to Cuvva'); | |
const num = await call.collect('plz enter ur policy number', { digits: 10 }); | |
const policy = await db.getPolicyByRef(num); | |
const user = await policy.getUser(); | |
call.say(`thanks for getting in touch, ${user.preferredName}`); | |
/// etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment