1

I'm trying to stream an audio file from AWS' S3 cloud-hosting service to my Google Home. The audio is a text-to-speech rendering of a Rasa bot's output. That bot output comes in response to a user input that gets captured by means of a Google Assistant on the same Google Home device. That Rasa bot is integrated with a Dialogflow agent, so that it can work on Google platforms like these ones.

So, the flow of the signal throughout the whole app is as follows:

1.) Google Home ---> Google Assistant

2.) Google Assistant ---> Dialogflow

3.) Dialogflow ---> Rasa Bot

4.) Rasa Bot ---> Audio File on S3

5.) Audio File ---> Google Home?

Does anyone have any help for how I could do this? My code is as follows, with a quick explanation below it too:


    const { actionssdk,dialogflow, } = require('actions-on-google')
    const assistant = actionssdk();

    app.post('/assistant', assistant);

    assistant.intent('', conv => {
      conv.ask(new MediaObject({
        name: 'botsAudioResponse',
        url: 'https://rapbot.s3.amazonaws.com/hi.mp3',
        description: `An audio rendering of my Rasa bot's response`
      }));
    });

I have the Rasa bot send a POST request to the '/assistant' endpoint in my Node.js app. That endpoint then calls the .assistant() function from the npm Google Actions library. That .assistant() function is an instantiation of the { actions sdk } object, which comes from the 'actions-on-google' npm library. However, when conv.ask(...) gets called, nothing happens!

I expected a message to be printed to my Dialogflow agent's textbox, but it didn't. I also tried simple stuff, like conv.ask('Hello!'), but couldn't get that to work either. When I console log the conv parameter in assistant.intent(), it's missing a lot of the info that my Google Actions Tester console tells me should be included (userName, etc.)

This Stack Overflow link has been really helpful: ["Actions on Google—Playing an audio stream?"][Is it possible to play audio file or stream?

It's where I got the conv.ask(new Media Object({...}) code from, but I can't exactly figure out how to make sure my assistant instance refers to the correct Dialogflow agent. So, my suspicion is that I'm calling the conv.ask() method, but it's not being sent anywhere (or to the right place).

I tried setting the .JSON file with the keys that you can download from Google as an environment variable in the terminal window, but still—no luck! :( haha

Thanks for your help!

0 Answers0