visionsnas.blogg.se

Magic 8 ball responses
Magic 8 ball responses








magic 8 ball responses
  1. MAGIC 8 BALL RESPONSES UPDATE
  2. MAGIC 8 BALL RESPONSES CODE
  3. MAGIC 8 BALL RESPONSES FREE

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.

magic 8 ball responses

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

magic 8 ball responses

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

  • #event: to receive the event from Nexmo API and print it into the console.
  • #caller_input: to respond to with a randomly selected answer to the caller’s question and handle input errors.
  • To achieve this flow, you’ll need to create these actions & routes in your app: Then the app randomly selects an answer to read back to the user. To demonstrate that they’re ready to receive some sage advice, the user is prompted to press 1 into their keypad. The user dials into the app and is prompted to ask a question. Let’s quickly pause to talk about the flow of this app before diving into the code.

    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.

  • Run your app and answer all of life’s tough questions ( the yes or no ones, that is)!.
  • Set up the Routes and Controller within the app.
  • ngrok to expose your Rails application to the outside.
  • Purchase one, go to Numbers > Buy Numbers and search This tutorial also uses a virtual phone number. You can find your API Key and API Secret at the top of the

    MAGIC 8 BALL RESPONSES FREE

    Today and start building with free credit. To complete this tutorial, you will need aĪPI account.










    Magic 8 ball responses