James
James

Reputation: 729

Using audio files as no input prompts in Google Actions

I am trying to set up re-prompts in my Google Action, and I require them to be audio files.

This is my implementation:

    'use strict';

const { dialogflow } = require("actions-on-google");
const functions = require("firebase-functions");
const app = dialogflow();

app.intent('Default Welcome Intent', (conv) => {
  conv.noInputs = [`<speak> <audio src = "https://myurl.com/audio/myfile.mp3">My audio file</audio></speak>`];
  console.log("Logging the conversation object... ");
  console.log(JSON.stringify(conv));
  conv.ask("Hello! ");
});
exports.yourAction = functions.https.onRequest(app);

However, at the moment it will just read the raw string of this noInputs array when I do a "no input" in the dev console!

Upvotes: 0

Views: 26

Answers (1)

Prisoner
Prisoner

Reputation: 50731

Using this kind of static no-input handling is not suggested.

Better is to create an Intent that handles the actions_intent_NO_INPUT Event. You can then use the response section (or a response from your Fulfillment) to include SSML with the audio tag.

Upvotes: 1

Related Questions