UPDATE: The first answer only works with V1 Dialogflow. As for V2, you can create mediaResponse as follows (from Google Doc):
conv.ask(new MediaObject({ name: 'Jazz in Paris', url: 'http://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3', description: 'A funky Jazz tune', icon: new Image({ url: 'http://storage.googleapis.com/automotive-media/album_art.jpg', alt: 'Media icon', }), }));
=================================================== ========================
I posted the answer here .
In essence, you can create a mediaResponse object that will play your audio file. I can play an audio file in 50 minutes.
Sample code in Node.js could be (with current documentation):
const richResponse = app.buildRichResponse() .addSimpleResponse("Here song one.") .addMediaResponse(app.buildMediaResponse() .addMediaObjects([ app.buildMediaObject("Song One", "https://....mp3") .setDescription("Song One with description and large image.") // Optional .setImage("https://....jpg", app.Media.ImageType.LARGE) // Optional. Use app.Media.ImageType.ICON if displaying icon. ]) ) .addSuggestions(["other songs"]);
RΓ©mi C.
source share