I am developing an action with Dialogflow and actions-on-google library for Node.js. First, I open the action and then I say, for example: "Bring Pizza" which invokes the 'Pizza' intent. If I say again "Bring Pizza" (in a screen device) action freezes. Happens with any intent I have. Text goes up and action just stops. Note: This only happens with real screen devices, not happening on my phone or device simulator.
My welcome intent just asks a question
// Welcome Intent
agent.intent('Open', async (conv) => {
conv.ask("To test, say: Bring Pizza")
});
Pizza Intent invoked when saying "Bring pizza"
// Pizza Intent
agent.intent('Pizza', async (conv) => {
conv.ask("Say bring pizza again"); //Just for test purpose
});
Intents in Dialogflow are fulfilled with a webhook intent call to a Firebase function. Pizza intent in DialogFlow. Open Intent in DialogFlow
Related
I need a callback URL so that when a mobile money API completes a payment transaction, my app can receive a message about the transaction status. I'm building a flutter app. I have seen that cloud functions may be the answer. So, I need help on how to get started on creating this callback URL.
I'm yet to try anything because all the material I have seen talks about JavaScript and websites. I need material on doing this in the flutter mobile app.
look at this snippet I hope it helps
// await for your first function t
await moneyFuntion()
.whenComplete(() async => await anotherAPIFuntion())
.onError((error, stackTrace) {
log("$error");
I have an app in which I am using FCM (Firebase Cloud Messaging).
As given in the README, I've managed to get it all working and the event handlers for onResume, onMessage, onLaunch are all firing properly.
The onBackgroundMessage which I think is supposed to run whenever the notifications appear while the app is inactive, needs a top-level dart function.
I need this function to render a particular widget, say, IncomingCall. But this being a top-level function, the best I could think of, is to invoke the main():
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
main();
}
which then calls runApp(IncomingCall()) but even this is not working.
So how does one render a widget in Dart when the app is inactive?
What I'm trying to achieve is user authentication (account linking) before the default welcome intent is called.
(I'm aware that in the design documents it is recommended to not require users to authenticate, but it is required for our action)
We have an undeployed action that I have tested in the simulator. The conversation flow is
The user is prompted to signin ie, new SignIn()
They are prompted to create an new item
The item is saved and the user receives a success/fail response and continues
In DialogFlow I have a Default Welcome Intent (prompts the user to create an new item), an intent to capture the item.
Our fulfillment intents
app.intent('ask_for_sign_in_detail', (conv) => {
conv.ask(new SignIn());
});
app.intent('ask_for_sign_in_confirmation', (conv, params, signin) => {
if (signin.status !== 'OK') {
return conv.ask('You need to sign in before using the app.');
}
// const access = conv.user.access.token;
// exchange access.token for jwt from backend
return conv.ask('Great! Thanks for signing in.');
});
app.intent('Default Welcome Intent - fallback', (conv) => {
createItem(conv);
});
In DialogFlow under integrations for the Google Assistant I have required that Sign In is required before the Default Welcome Intent.
When I go to test in the simulator I can see that under account linking there is no information (ie, no accounts linked) and there is a message stating 'No account is linked to Google. Start a test conversation for account linking.'
Starting a conversation I get the following error:
Your voice wasn't recognized, so I can't connect you to Talkatoo.
Check the Voice Match settings in the Google Home app.
I am not sure where I have strayed trying to authenticate users with their Google accounts.
This has been fixed by Google as of 2019-07-19 02:57 PDT. Received a response from the AoG team, and tested it in the simulator. It was a Google bug.
We are creating an Action on Google using Dialogflow V2 API. We are using firebase cloud functions for our fulfillment and we are using an external rest api for our crud operations.
We have an undeployed action that I have tested in the simulator. The conversation flow is
The user is prompted to signin ie, new SignIn()
They are asked what they want to do and they respond
Their response is saved in our backend using their credentials
new SignIn() works in the simulator, but when I test on the Google Home Mini the SignIn() responds as if the user has rejected the propmpt to signin before they have time to respond
Is there some restriction regarding testing an Action that include Account Linking on the Google Home Mini?
The intent containing the new SignIn() is my Welcome intent, could that be causing the issue?
Here are the two intents handling SignIn(). Start Signin Intent is triggered by the Welcome Event
app.intent("Start Signin", (conv) => {
conv.ask(new SignIn());
});
app.intent("Get Signin", (conv, params, signin) => {
if (signin.status === "OK") {
const payload = conv.user.profile.payload;
conv.ask(`I got your account details, ${payload.name}. What do you want to do?`);
} else {
conv.ask(`I won't be able to save your data, please login`);
}
});
I'm using actions-on-google github nodejs app with DialogFlow. I'm trying to figure out how to make an async api call that takes longer than 5 seconds and return the response to the user when the response is ready, considering that actions on google returns Malformat error if a response is not received from the intent within 5 seconds.
This is a simple code snippet of my code:
app.intent('first-intent', async (conv: any) => {
conv.ask('Please wait while we make our long api call...');
await myPrivateFunction();
})
// I have put API_RESPONSE_RECEIVED as Events in DialogFlow
app.intent('second-intent', (conv: any) => {
console.log('This is second-intent');
var response = conv.data.apiResponse;
conv.ask(response);
})
function myPrivateFunction(): Promise<void> {
utils.apiCall().then(apiResponse => {
console.log('api response received');
conv.data.apiResponse = apiResponse;
conv.followup('API_RESPONSE_RECEIVED');
});
}
In my Firebase logs I can see "Please wait while we make our long api call..." and "api response received", but not "This is second-intent". If I put conv.followup('API_RESPONSE_RECEIVED') outside the api call right after conv.ask('Please wait while we make our long api call...'), I see "This is second-intent". So, app.followup looks OK and apparently the problem is about how I'm handling the promise, but I don't know how to fix it.
I'm using TypeScript targeting es5 in my development environment. So, I can use await/async on my api call. However, using await causes that malformat error since the api call takes longer than 5 seconds.
We don't really have a good way to handle this right now, but we have a couple of approaches that sorta work based on your needs.
Notifications are currently available for the Assistant on smartphones, and they're coming for speakers. In some cases, it might make sense to say that you're working on the problem and you'll send a notification when you have it, and then resume the conversation from the notification.
Another approach is to use the Media Response to play a bit of "hold music". Under this scheme, you would start the async call, but also immediately send back the "hold music response". When the long async call completes, it would save the result in a local cache. At the end of the segment of music, your webhook will get a notice that the music has completed. If you have the result available in the local cache, you can report it at that time, otherwise you would play more hold music and repeat this process.