Reputation: 705
I have built a custom view/webpage for my bot using the 'api-ai-javascript' sdk. Everything is working great but I can't get the RichResponse back from my fulfillment (Cloud functions). Here is my fulfillment code using 'actions-on-google':
const { DialogflowApp } = require('actions-on-google');
...
if(hasScreen){
//hasScreen = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)
app.tell(app.buildRichResponse()
.addSimpleResponse('We found the perfect item for you! ' + product.title)
.addBasicCard(app.buildBasicCard( 'Your item is ' + product.title )
.setTitle('Your perfect item!')
.addButton('View Item', 'https://retailer.com/item/' + product.id)
.setImage(product.imgurl, 'Product Image')
.setImageDisplay('CROPPED')
)
)
} else if (hasAudio){
//hasAudio = app.hasSurfaceCapability(app.SurfaceCapabilities.AUDIO_OUTPUT)
app.tell('No screen buy yes audio.)
} else {
app.tell('No screen no audio.')
}
But for some reason when testing in the browser I always get the last response 'No screen no audio.' Here is my client code using the api-ai-javascript (version 1).
import {ApiAiClient} from "api-ai-javascript";
...
client.textRequest(text)
.then((response) => {
//here I only receive 'No scree no audio'
//I need the rich response here
})
It's working great when I test the screen in Google, but not on my site. How can I get the RichResponse?
Upvotes: 1
Views: 632
Reputation: 50741
The "actions-on-google" library is only for handling messages sent by the Google Assistant - from places like a speaker device like a Google Home or through the Assistant app on a mobile device.
It sounds like you're using the Dialogflow Web Demo integration or using the Dialogflow API to send queries directly, then you're not sending additional information that is unique to the Assistant platform. So while you're using Dialogflow to handle your Natural Language Processing, you can't take advantage of the features that are delivered through the Assistant platform.
Upvotes: 1