cheung31 / client-quickstart-node

Twilio Client Quickstart App

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twilio

Twilio Client Quickstart for Node.js

Build Status

This application should give you a ready-made starting point for writing your own voice apps with Twilio Client. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account SID Your primary Twilio account identifier - find this in the console here.
Auth Token Used to authenticate - just like the above, you'll find this here.
TwiML App SID The TwiML application with a voice URL configured to access your server running this app - create one in the console here. Also, you will need to configure the Voice "REQUEST URL" on the TwiML app once you've got your server up and running.
Twilio Phone # A Twilio phone number in E.164 format - you can get one here

Setting Up The Node.js Application

  1. Create a configuration file for your application:

    cp .env.example .env
  2. Edit config.js with the four configuration parameters we gathered from above.

  3. Next, we need to install our dependencies from npm:

    npm install
  4. Now we should be all set! Run the application using npm.

    npm start

    Your application should now be running at http://localhost:3000. Leave the server running and continue on in another command window.

  5. Download and install ngrok

  6. Run ngrok:

    ngrok http 3000
  7. When ngrok starts up, it will assign a unique URL to your tunnel. It might be something like https://asdf456.ngrok.io. Take note of this. Note you must use the https URL, otherwise some browsers will block microphone access.

  8. Configure your TwiML app's Voice "REQUEST URL" to be your ngrok URL plus /voice. For example:

    screenshot of twiml app

    You should now be ready to rock! Make some phone calls. Open it on another device and call yourself. Note that Twilio Client requires WebRTC enabled browsers, so Edge and Internet Explorer will not work for testing. We'd recommend Google Chrome or Mozilla Firefox instead.

    screenshot of chat app

Run tests

npm test

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

About

Twilio Client Quickstart App

License:MIT License


Languages

Language:JavaScript 75.1%Language:CSS 17.9%Language:HTML 6.9%