Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including voice-repeater with all npm packages installed. Try it out:

var voiceRepeater = require("voice-repeater")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

voice-repeater v1.0.3

Drop in module for replaying prompts when the user ask for repeat of the last prompt

VoiceRepeater

Actions on Google Dialog Flow add-on. VoiceRepeater is a drop in module that repeats the last prompt with a prefix.

You need to run the following in the directory of your package.json:

npm install voice-repeater --save

You need to add something like the following to your code:

If you are following the action map pattern, there are four things you need to do in the code

  • Add require statement
  • Configure VoiceRepeater
  • Add function handler
  • Register function handler
const VoiceRepeater = require('voice-repeater').VoiceRepeater; // Add require statement

exports.yourFunction = functions.https.onRequest((request, response) => {
    ...
    let voiceRepeater = new VoiceRepeater(app);  // Configure VoiceRepeater
    function repeatLastStatment(app) { // Add function handler
      app.ask(voiceRepeater.lastPromptWithPrefix());
    }
    const actionMap = new Map();
    actionMap.set('repeat_last_statement', repeatLastStatment); // Register function handler
    app.handleRequest(actionMap);
});

Add changes to API.AI

You should create an intent that will trigger when you want the voice app to repeat itself.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free