I have AoG action that is logging-in to external backend and once logged in it can control specific appliance via external backend's API. Action basically controls home alarm via commands like arm section XY, disarm section garage, etc. Before getting control to alarm it is necessary to login and this takes considerable time (approx. 20-30 seconds). This is much longer than AoG actually allows resulting in timeouts. I am initiating login as asynchronous operation in actions.intent.MAIN handler (i.e. not waiting for the result of login within handler) and just saying to user to tell the command (arm/disarm garage, etc.) in couple of seconds. I have also implemented push notification which is working fine. Problem with push notification is that it just pops up on mobile phone without any sound & user has to open notifications and tap it. Then it will trigger intent and do requested action.
This is not really good user experience (typically I would like to use my action in the car when coming home and having the possibility to disarm the home alarm without need to touch the phone, tap the notification, etc).
Any idea how to implement it in more proper way? What I would really appreciate is if google assistant could actually re-initiate the conversation & tell me something like: 'hey I am already logged in into alarm service provider, what do you want me to do now?'.
I will be grateful for any advice dealing with similar problem.
I am using ActionsSDK for Node.JS to build my action.
You've already looked at the ways that the Assistant can initiate (or re-initiate) a conversation. Actions are really designed for something that is conversational, and a 30 second pause in the conversation would be awkward.
One other option you have is to use a Media Response as part of your reply to the user logging in (or as part of your welcome intent? Not entirely clear, but the approach would be the same). This would let you play some "hold music" for several seconds. At the end of the music playing, an actions.intent.MEDIA_STATUS would be sent to your Action, which you can use to make sure the login has completed and, if so, respond to the user appropriately.
The only way for AoG to "take initiative of starting a conversation" is through push notifications. There is no way for the assistant to strike up a conversation after a period of time or when an event occur.
Perhaps another way of doing might be to only send push notification if your action fails to execute the long sequence of events and the triggering action could invoke an intent to try again. The assumption would be that everything's fine unless said so.
You could also notify the user that it'll take a couple of seconds to complete the action once it's initated and implement followup intents that handles if the user asks "Is it done?" or "How's it going?". Making it part of the flow to check on progress, but with the assumption that it should be successful.
You can easily dislocate the long running background process by implementing a task queue in Firebase where your intent is creating a child similar to this.
firebase.database().ref("tasks").push({action: "disarm_garage"});
And then you create a cloud function trigger to handle it
functions.database.ref('tasks/{id}').onCreate((snap) => {
const action = snap.val().action;
switch (action) {
case 'disarm_garage':
// ...
break;
}
// Remove the task after processing
return snap.ref.remove();
});
That would ensure that you have enough time to complete the task in background without blocking the conversation.
Related
I have created a chat bot which responds to request.This is the flow currently happening:
I say "Talk to My Test App"
My app starts and says welcome message.
I request something and my intent is fulfilled
After this the Google Home does not pause but keeps on listening.
If I stop it then again I will have to say "Talk to My Test App", which I also don't want.
I want google home to sleep after fulfilment.
and Awake in the same app when I say "Ok Google"
More details:-
In my use case the user will talk to the app frequently, for example after every 30 seconds-2mins. I don't want him to say every time "Hey Google" to wake up and then "Talk to My App" and then the command. I also don't want to say long sentence after waking up the Google Home like "Talk to My App to Do this".So I thought it would be better that my app doesn't stop by ending the conversation, instead it should be paused.So that the user can just wake up Google Home and directly pass the command.
Currently Google Home does not pause after the first command and keeps on listening surrounding sounds and responds to the noise, because of this issue user has to stop it.
I needed to have a pause so I can narrate my thoughts but not exit my conversation for a client demo, so I added this in DialogFlow's text response, with a very long break at the end of each text response. I can then interrupt the pause with "Okay Google" and stay within my conversion.
<speak>This is a sentence with a <break time="600s"/> pause</speak>
As the name suggests, a conversational VUI suggests that you're going to have a conversation with the agent. Not something with long pauses in between. The assumption is that if there is no reply, that the user isn't actively engaging in the conversation. There is no direct feature that does what you want, although there are a couple of interesting workarounds that might work for you.
First, as you suggest, deep linking with a phrase such as "Hey Google, ask My App to Do This" is certainly a possible approach, and one that you should support. In production, and as a user uses it more, the introduction and hand-off from Google gets shorter and shorter. Even the launch phrase can be shortened with the user creating a Shortcut - but this is a choice of the user, not you.
Although there is no way to "pause" a conversation, there is a way to have the reply include streaming audio that the user can interrupt. Using a Media Response begins playing that media.
When the URL pointed to by the media ends, your Action gets a callback (via an Event in Dialogflow or an Intent with actions.json) indicating the media has ended, and you can do something like play another Media Response, and continue to do this as long as appropriate.
Are any time, your user can interrupt the audio by saying "Hey Google" and some command. This will trigger any matching Intent, as if they said a command as usual.
There are some caveats with this scheme - some commands don't actually work (anything with "next" in it, for example, since that sounds more like a media command that isn't implemented), and you need an audio of reasonable length that won't be distracting in your environment, but this might be a reasonable solution to your scenario.
If you want to exit the conversation you may do the following:
Go to the dialogflow console.
Create and intent (say goodbye).
In the Event section, enter 'actions_intent_CANCEL' in the add event field.
Enter your Training Phrases. (Say exit, stop, pause etc)
Enter your greetings (say goodbye) in text response. You may skip this if you don't want to reply.
Enable 'Set this intent as end of conversation'.
Save
I have created a google action project with dialog flow and action SDK, webhook and Android app to talk to it. Everything works fine except the "cancel" speech. I am asking user "Say cancel to cancel the order" but it closes the conversation itself.
Really need help here.
When the user says "cancel", AoG's App Exits functionality is triggered. This causes the app to immediately exit. We do this with certain key words (e.g. "exit", "cancel", "stop", "nevermind", "goodbye") so that users are never stuck inside an Action with no clear way to get out.
While you can handle an event that will allow you to return a custom response when an App Exit is triggered, there is no way to prevent this behavior.
To avoid this, you should guide the user towards using different language, or provide affordances such as suggestion chips that will allow them to easily take action.
The Actions on Google design documentation recommends steering clear of "commands", avoiding statements such as Say cancel to cancel the order. Instead, you could ask the user if they'd like to cancel their order and handle yes or no as a response.
I have a Google Action (using API.AI) that is very similar to the Silly Name Maker webhook example.
However, my app was rejected for the following reason:
One or more of your actions does not allow a user to easily exit a conversation. Please make sure that you do not continue to converse with a user if they ask to cancel or exit.
When you say stop, cancel or quit when the mic is open, it responds "Sure, canceled", closes the mic and exits. However, when you try using those commands while the agent is speaking, it does close the mic and exit but it doesn't say "Sure, canceled" as it's supposed to.
My Action is set up like this:
Welcome intent: User is asked for two parameters
Webhook response: Once all the parameters have been supplied, a webhook (structured exactly like this Silly Name Maker webhook) delivers a single sentence and then immediately ends the conversation.
During the Welcome intent, if a user says "Okay Google, cancel" while the agent is speaking, it responds "Sure, canceled" and exits.
However, while the agent is speaking the webhook response (from assistant.tell()), if you say "Okay Google, cancel" it will exit immediately without saying "Sure, canceled."
How do I get the Google Assistant to say "Sure, canceled"? Do I have to set up a "cancel" intent in API.AI, and use an actionMap on my webhook to handle a user's request?
Use assistant.ask(), not tell, then cancel should work. You can have a look at https://github.com/actions-on-google/actions-on-google-nodejs/blob/master/assistant.js
I know this is an old question, but I have an answer nonetheless.
You can trap "Cancel" type requests from the user, if necessary, to play your own 'goodbye' message, as your yellow highlighted request seemed to desire.
(Is that review feedback? Weird...)
As described here:
https://developers.google.com/actions/assistant/app-exits
The basic trick is to setup an Intent in Dialogflow that is configured for the 'event' of "actions_intent_CANCEL".
Set it to 'end the conversation' (or it won't work, I think).
Don't set any example phrases.
Set the desired 'Response', or set it to hit your webhook.
With that setup, you can get "Cancel" requests to say anything you want on app exit, up to a 60-character limit (To allow the user to quit quickly).
Currently, there is no way to open up the mic when you are doing an app.tell() from inside your custom app. So, there's no way to interrupt the response.
Only the phrase "ok google" opens up the mic. So you could add user says for "ok Google" to go to your fulfillment. That way you can handle the interruption in your own app.
Google rejected my app and give the following feedback:
During testing we noticed that when the Action is not able to get data
it opens the mic and leaves it open without prompting. Make sure that
your agent always says something before leaving the mic open for the
user, so that the user knows what they can say. This is particularly
important when your agent is first triggered.
I've built my app using API AI tool and webhooks (connects to a web service running on Heroku). Heroku sleeps after 30 minutes of inactivity. I think this error occurs when Heroku takes a long time to respond. Any idea how can I make the agent say something before leaving the mic open?
I am not sure why I got this feedback because in case the web service request times out, Google Home speaks the following response.
It might answer the text response you added on API.ai but at the bottom of the page of your intent (under the text response) click on "Actions on Google" then check "End conversation" Check this screenshot
When you use assistant.ask in your fulfillment logic, you should be asking the user a question. It should be clear to the user what they are expected to answer.
If your fulfillment instance goes to sleep or doesn't respond quickly, then typically the assistant will play a message that indicates your action isn't responding.
I am not a developer as much as i am a project manager, i need to know more if the following is possible to help me decide the future of a project.
mainly my question is, can i trigger a certain method (function) in my application using the push notification ? so my app might be in the background (or not) and i want to send a push notification message that wakes the application and execute some piece of code.
if the answer is yes, can this be done without the user interaction ? so i mean without the user clicking on the push message ? to be some kind of automated, so i send the Push notification message, the iPhone receives it and execute the code, without the use interaction ?
i can set up my own APNS server if needed.
i am not looking for a code as much as i am looking for an answer if this can be done or not.
Thanks,
Yes, this is possible, as long as the user clicks on the notification. This could be done either with local notifications, or push notifications.
When an application is launched in response to a notification, the AppDelegate method application:didFinishLaunchingWithOptions: will have an option indicating the notification that precipitated the launch.
It cannot, to my knowledge, be achieved without user interaction.