GithubHelp home page GithubHelp logo

bpropelled / client-quickstart-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twiliodeved/client-quickstart-js-deprecated

0.0 1.0 0.0 16 KB

Twilio Client Quickstart for Web/Javascript

License: MIT License

HTML 13.57% JavaScript 57.05% CSS 29.38%

client-quickstart-js's Introduction

Twilio

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

Config Value Description
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 to point to a Twilio Function you will create.
Twilio Phone # A Twilio phone number in E.164 format - you can get one here

Creating the quickstart functions

To get you up and running with this quickstart, you can use a template to create your functions. Start by going to the Twilio Functions page in the Twilio Console.

You can add new functions with the plus button on that screen. Look for the Twilio Client Quickstart template, and create it. You'll need the two values you gathered above as the configuration settings for this template.

After you successfully put in the configuration, you'll have two Twilio Functions - one for the capability token, and one for the TwiML web application's voice response.

Configuration and setup

Configure your TwiML app's Voice "REQUEST URL" to be your Twilio Function URL - you can copy and paste the URL directly from the voice calls function page. For example:

screenshot of twiml app

Also, you'll need to modify the function URL in quickstart.js to point to your capability token Function - go ahead and copy the capability token URL like you did for the voice calls URL, and put that into quickstart.js, replacing this line:

https://YOUR_FUNCTION_SUBDOMAIN_HERE.twilio.io/capability-token

The subdomain you use for Twilio Functions will be the same for any functions you create - including the capability token and voice call functions.

Warning

NOTE: You should not use Twilio Functions to generate capability tokens for your app in production. Each function has a publicly accessible URL which a malicious actor could use to obtain tokens for your app and abuse them.

Visit our guide to learn how to generate capability tokens in your own C#, Java, Node.js, PHP, Python, or Ruby application.

Setting up a local HTTP server

You'll need to load the front end of your web application from a web server for Twilio Client to connect successfully from Chrome (it should work in Firefox if you load it from the file system). The easiest way to do that is to install a local HTTP server like http-server

npm install http-server -g

or

sudo npm install http-server -g

on macOS or Linux

Run the local server

http-server

Have some fun

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

Meta

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

client-quickstart-js's People

Contributors

atbaker avatar jefflinwood avatar joliveros avatar michaelrkn avatar po5i avatar sedenardi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.