

Note: Be sure to save your ngrok.io URL somewhere safe! You’ll also be using it in the next few steps.
MAGIC 8 BALL RESPONSES UPDATE
The first is the externally accessible ngrok URL, which ends with ngrok.io and points to your local server.Ĭopy and paste that URL into your responses_controller.rb file and update the NGROK_URL = " to be that URL (the one that is running locally on your machine right now). Near the top of the interface is a line that begins with Forwarding and contains two URLs. You should now see a ngrok logging interface in your terminal window. Here, ngrok is pointing to the 3000 port as it assumes that your local server is running on If you’re running on a different port, be sure to adjust the ngrok command. This will randomly select a Magic 8-Ball response from the POSSIBLE_RESPONSES array. If the caller hits any other key or doesn’t input anything at all, the app will ask the caller to try again.

We’ll use 'dtmf' here to accept the number 1 as a signal to the app that the caller is ready to move on to the next flow. Next, you’ll need to handle the caller’s input.\ĭual Tone Multi Frequency (DTMF) is a form of signaling used by phone systems to transmit the digits 0-9 and the * and # characters. Ask your question and then press 1.', :bargeIn = > true }, ]. # responses_controller.rb class ResponsesController 'talk', :text = > 'Welcome to the Magic Eightball hotline. To answer the call, handle the caller input, and print the events to your terminal you’ll need to write three unique routes. So that your app knows where to direct the Nexmo GET request, you should define the routes in routes.rb.\

Now that the flow of the app is clear, let’s dive into the fun part and write the Routes and Controller Actions! Set up the Routes Within the App
MAGIC 8 BALL RESPONSES CODE
Move into your new Rails app folder cd magic8-ball-voice-app and open it in your preferred code editor. (As there’s no persistent data for this app, adding the -api -skip-active-record part helps make your app super lightweight!) $ rails new magic8-ball-voice-app -api -skip-active-record To begin, initialize a new Rails API project.\įrom the command line execute the following: If you’d like to see the finished code, you can clone the git repository for this project. This tutorial takes you through the process from scratch.
MAGIC 8 BALL RESPONSES FREE
Today and start building with free credit. To complete this tutorial, you will need aĪPI account.
