Giter VIP home page Giter VIP logo

twiliogatherspeechdemo's Introduction

A Demonstration of the input property in the Twilio Gather verb

This is a Ruby program to demonstrate Gather using speech. This program will make a webhook call out to a twilio function. The twilio function (twilioFunction.js) will then capture the SpeechResult property. It will then use the Say verb to say back what was said during the Gather, demonstrating the speech recognition capabilities of the Gather verb.

Getting Started

Step 1. Install Ruby on your workstation.
Step 2. Install the Twilio Ruby helper library. To install the Twilio Ruby help library, type 'gem install twilio-ruby'.
Step 3. Install Sinatra.
Step 4. To install Sinatra you will need to make sure you have Bundler installed. (https://bundler.io/)
Step 5. Type 'gem install bundler' to install Bundler.
Step 6. Install the Gemfile by typing 'bundle install'.
Step 7. Type './ngrok http 4567' to start ngrok and have it proxy from port 80 to port 4567.
Step 8. Once ngrok starts you will see a 'Forwarding' URL.
Step 9. Input the URL from ngrok in the webhook for a Twilio phone number in the Twilio console.
Step 10. Make sure to set the webhook for your Twilio number in the Twilio console to use a GET request not a POST request.
Step 11. Copy and paste the node.js program from 'twilioFunction.js' to a Twilio function in the Console.
Step 12. Uncheck the Access Control checkbox on your Twilio Function that says "Check for valid Twilio signature'.
Step 13. Update the action property in the Ruby program with the URL of the twilio function.
Step 14. Type 'ruby SpeechResultDemo.rb' to start the program.

Running the demonstration

Using the demonstration is very straightforward. Call your Twilio phone number. You will hear the message "Please say something then hit the pound sign and the the program will repeat it back to you demonstrating that your speech result was captured." Say something, type the pound key once you are done speaking.

The demonstration will repeat back what you say to it. The Ruby program sends what is captured by the Gather verb to the action URL which is your Twilio function. This Twilio function parses the JSON that is sent to it by Twilio and grabs the property "SpeechResult" and inserts it into a Say verb and returns the TwiML to Twilio which tells Twilio to say back to you what it captured during the Gather verb. This is an easy demonstration of the Gather verb and the Speech input capabiliities.

Prerequisites

A Twilio account
A Twilio phone number
A Twilio function
Ruby
Twilio Ruby help library
Sinatra

Authors

  • Mark Shavers - Initial work - shavez00

twiliogatherspeechdemo's People

Contributors

shavez00 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.