Try to search your question here, if you can't find : Ask Any Question Now ?

How to play an audio file on dialogflow using firebase function

HomeCategory: stackoverflowHow to play an audio file on dialogflow using firebase function
Avatarjohn asked 3 months ago

I have my own server where audio file is uploaded. http://www.theislam360.me:8080/hbd.mp3
I want to play this audio on google home using firebase functions.

const functions = require('firebase-functions');
var request1 = require('request')
exports.webhook = functions.https.onRequest((request, response) => {

        console.log("request.body.result.parameters: ", request.body.result.parameters);

        let params = request.body.result.parameters;

        var options = {
            url: `https://theislam360.me/${params.any}`+".mp3",
            json:true
        }
        request1(options, function(error, res, body){
            if(error) response.send({speech: "error in API call"});
            else response.send({speech: "<speak>This is the audio <audio>www.theislam360.me:8080/hbd.mp3</audio></speak>"});
        });
    });

I am getting Internal server error on dialogflow fulfillment. Here is the firebase logs.
enter image description here

1 Answers
Best Answer
AvatarArben answered 3 months ago
Your Answer

7 + 7 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com