I am building an action with Google Actions SDK, and for a scene I am using a webhook for onEnter. My question is how do I add suggestion chips using the webhook function.
This is my webhook
app.handle('startSceneOnEnter',conv=>{
conv.add('its the on enter of the scene');
});
I could not find how to add suggestion chips with conversation, any help would be great.
A suggestion chips can be added with the Suggestion class.
const {Suggestion} = require('#assistant/conversation');
app.handle('startSceneOnEnter', conv => {
conv.add('its the on enter of the scene');
conv.add(new Suggestion({ title: 'My Suggestion' }));
});
Related
I created a Google Action using the Google Actions console, then pulled it using the gactions CLI and now I am trying to connect my intents to a fulfillment webhook but don't know how.
I tried using the following code for the fulfillment from the Google Action help:
const { conversation } = require('actions-on-google');
const functions = require{'firebase-functions'};
const app = conversation();
app.handle('sayHello', conv => {
conv.add("Hi there! It\'s good to see you!");
})
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app)
Conversation doesn't seem to exist and I am having trouble finding other ways of accepting requests.
This is my current directory:
How can I send requests to the fulfillment webhook from intents?
The conversation is the term for the container when using Actions Builder or Actions SDK along with the #assistant/conversation library.
If you are using either one, you should change libraries.
If you are using Dialogflow, you would want to keep actions-on-google as the library and switch the method from app.handle to app.intent.
Additionally, this may be an encoding problem, but when your handler contains conv => { there should be a 'greater than' symbol instead:
conv => {
When using google actions sdk, as per documentation, we achieve it via such a code
app.intent('actions.intent.TEXT', (conv) => {
conv.ask(new SignIn('To get your account details'));
});
Is there a way to add suggestion chips such as Yes and No. Thanks
I have recently create an action and tested it in web simulator and on my Pixel 2 device. It is working fine for me. But during the review process the team at Google mentioned that while reviewing they found that error saying that my app isn't responding right now. Try again soon. (Screenshot attached). Can someone from the community please assist me on how to resolve the issue.
Below is the code in fullfillment, if this helps.
'use strict';
// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');
// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');
// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});
// Handle the Dialogflow intent named 'favorite color'.
// The intent collects a parameter named 'color'.
app.intent('think number', (conv, {nextStep}) => {
conv.close('The result is 9.');
});
// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
Screenshot of the response from Review Team:
Sometimes they are a bit quick to reject if there are network problems between them and Dialogflow, or if Dialogflow isn't responding. Make sure you turn on Dialogflow's logs to make sure there is no problem.
In general, the easiest thing to do if you haven't seen any errors and things appear to be working on your end is to:
Resubmit
Reply and tell them that you're using Dialogflow and there should be a reply.
My Dialogflow agent is using an 'Actions on Google Rich Message' List response object to display options on the Google Assistant platform.
The list options work perfectly when testing on the Dialogflow console. However, when testing through the Google Assistant Simulator or Google Assistant app on a mobile device, the list option does not work on the first try. It works only when selecting an option the second time. Below is my intent code which generates the list.
app.intent('Default Welcome Intent', conv => {
conv.ask('Hi welcome to micro strategy. I am Emily, your virtual assistant. Please tell me how can I help you');
conv.ask(new List({
title: 'Please choose',
items: {
['SELECTION_KEY_GET_CALENDAR_EVENTS']: {
synonyms: [
'Get calendar events',
],
title: 'Get calendar events',
description: 'Lets you retrieve calendar events',
},
['SELECTION_KEY_MODIFY_EVENTS']: {
synonyms: [
'Modify calendar events',
],
title: 'Modify calendar events',
description: 'Lets you modify calendar events'
},
},
}));
});
Any guidance would be appreciated.
This is because you must have an intent that handles the actions_intent_OPTION event, which is what is fired when you touch for the first time an element in the list.
Lists / Carousel always fire that event. If no intents can handle the actions_intent_OPTION event, then the conversation goes to the Fallback intent.
Refer to the documentation, section List > Requirements > Interactions > Voice/Text : Must have an intent for touch input that handles the actions_intent_OPTION event.
Let me know if it helps, Marco
My app is based on this code sample from Google: https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation_question.deeplink.html
Here is a snippet directly from my code:
app.intent('Default Welcome Intent', conv => {
conv.ask('Great! Looks like we can do that in the app.')
conv.ask(new DeepLink({
destination: 'MyBookApp',
url: 'https://www.mybooksite.com/read/123456789',
package: 'com.mybook.app.reader',
reason: 'handle this for you',
}))
})
// Create a Dialogflow intent with the `actions_intent_LINK` event
app.intent('Get Link Status', (conv, input, arg, status) => {
// possibly do something with status
conv.close('Okay maybe we can take care of that another time.')
})
When I run this app I see "Okay maybe we can take care of that another time." instead of my app being launched.
Is there code missing in my handler for the 'Get Link Status' intent? (I created the intent according to the comment above that line).
Am I passing the wrong params to the DeepLink object? I can't find docs for them anywhere.
Note: My app is definitely coded to handle http deep links including verification with Google Digital Asset Links and the deep link URL I'm testing with works perfectly from other apps.
Any suggestions or help is much appreciated!
Thanks in advance...
Your welcome intent handler is missing an additional call to conv.ask before the deep link call:
conv.ask('Great! Looks like we can do that in the app.')
All responses should have at least a simple response.