Skip to content

Instantly share code, notes, and snippets.

@billinghamj
Created August 30, 2015 18:32
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 billinghamj/8f66fa91acb79f790a97 to your computer and use it in GitHub Desktop.
Save billinghamj/8f66fa91acb79f790a97 to your computer and use it in GitHub Desktop.
Twilio async/await
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