Google Home report state request is working but not showing expected result? - actions-on-google

I'm integrating google assistant with my application. The problem is when I send a report state request to assistant while inside a device screen in google home application, I get a 200 OK response with the requestId I'm sending, but the device screen doesn't update with the device state. (It gets updated after I go back and go to device screen again but that is done through query intent)
Sample Request Body
{
"payload" : {
"devices" : {
"states" : {
"12364" : {
"on" : true
}
}
}
},
"requestId" : "A7TNpoXlnG0OQWzpTvJAa4sjolAAt46q",
"agentUserId" : "14556"
}
Sample Response Body
{ "requestId" : "A7TNpoXlnG0OQWzpTvJAa4sjolAAt46q" }
This is their documentation regarding the report state.
I even deployed the report state dashboard locally to monitor the state changes but it doesn't update as well.
Can anyone point me in right direction? Thanks!

The behavior of different Assistant surfaces with respect to Home Graph changes can vary, so it's best not to rely on looking for real-time UI changes in the Google Home app.
The Report State Dashboard noted in the documentation that you linked is a good way to validate the state you publish to Home Graph graphically. We also recently published an AoG ProTips episode on this topic that shows you how to do the same from the command line.
Neither of these methods will update automatically in real-time either, but you can refresh them after publishing a state change to verify the right data is in Home Graph.

Related

how to respond to user using google assistant after the conversation is ended?

I am making a google action.I have one scenario where calculation requires some time in cloud fulfillment but i don't want to keep user waiting for answer.
I want to respond to user whenever my answer is ready even when conversation with user is ended i want to send my answer in notification or something like that.
I just found this on google actions documents.
https://developers.google.com/actions/assistant/updates
Is this possible in google actions and how?
What you mean here is notifications. You can use it but please pay attention to the warning at the top of the link you provided: "Updates and notifications are currently in Developer Preview. You can build apps using the features described in this article, but you can't currently publish them".
As for the steps to crated a daily notification:
Navigate to your actions.intent.CONFIGURE_UPDATES intent.
Under Responses, go to the Google Assistant tab, click Add Message Content, and select Custom Payload.
In the "Custom Payload" box, add the following code to call the AskToRegisterDailyUpdate helper. Swap INTENT_NAME to the intent that you want to be invoked when the user interacts with your notification.
{
"google": {
"system_intent": {
"intent": "actions.intent.REGISTER_UPDATE",
"data": {"#type": "type.googleapis.com/google.actions.v2.RegisterUpdateValueSpec",
"intent": "INTENT_NAME",
"triggerContext": {
"timeContext": { "frequency": "DAILY" }
}
}
}
}
}
If using a webhook, you can call this API directly via the client library:
appMap.set('setup_update', function(app) {
app.askToRegisterDailyUpdate('INTENT_NAME');
})
})
Add one more intent called "finish_update_setup" and enter actions_intent_REGISTER_UPDATE as its Event.
Set the intent's Action to "finish_update_setup" as well.
In your webhook, open index.js and add the following. Replace Ok, I'll start giving you daily updates and Ok, I won't give you daily updates. with whatever response you want to give the user:
appMap.set('finish_update_setup', function(app)) {
if (app.isUpdateRegistered()) {
app.tell("Ok, I'll start giving you daily updates.");
} else {
app.tell("Ok, I won't give you daily updates.");
}
}
Deploy the webhook to Firebase Functions and enable webhook fulfillment in Dialogflow.
If you want to see how to create a simple notification (not daily one) - please check this doc on push notifications.
If you don't have an immediate reply to send but expect one soon-ish what you do is return a "promise". When you are in a position to reply, "fulfilling" the promise causes your reply to be delivered. I don't know what the actual timeout is but in my case I'm pretty sure at least a few second delay is allowed.
As for the updates or notifications, the API is there but the docs say you can't deploy an Action to production using them. There is a slightly cryptic comment to "contact support" if you need them.
One of these days I might try.

Still cannot find google action using Action SDK on Google Home App

I am developing a Google Smart Home App, and I follow the official development document.
Create my project in Google Console
'gactions update --action_project action.json --project {myproject}'
Complete the necessary information,including App Information, Account Linking;
'gactions test --action_project action.json --project {myproject}'
I have tried many times, even I used the other accout, and created it. But the result was same that my smart home app still not appear in my google home.
Someone said they created their app, and it would appear in Home Control section like [test]{project_name} after 'gactions test'. But it not work for me. It is very frustrated. And This step has blocked my further work for many days.
Further more, I want to confirm the following question:
When I created my smart home app, the section is like this:
Actions added from Actions SDK
Actions: (this place is emtpy, is it normal? or lack of something like agent or else)
The Smart Home App in test mode, it is required that voice-only conversations with the Google Home speaker, or directly appear in Google Home App after 'gactions test'?
Any help will be appreciated!
My action.json: { "actions": [{ "name": "actions.devices", "deviceControl": { }, "fulfillment": { "conversationName": "automation" } }], "conversations": { "automation" : { "name": "automation", "url": "https://xxxxx" } } }
running it the first time could be a bit painful. Below is what I do to get it working.
Make sure you have filled in all details on the action console.
Click on the Test button to start your app.
From the simulator, type Talk to . It might ask you to login.
If you can see the response from your app. Then it should work on your google home.
Please note that your test app will expire if you leave it idle for too long. You need to click on the test button to run it again or your google home won't be able to lunch your app.
Also, in your action.json, if you are pointing your intend to a webhook, please make sure your webhook is accessible from google.

What's wrong with my google actions response that prevents users input from working?

So, I am in the process of writing some Google Actions code against the Actions SDK. I am able to receive the requests and process them fine. I am also able to send responses that do not expect user response fine. However, when I send a response that expects a user to make a choice, the google assistant just keeps asking the question over and over no matter what the user says (except stop of course). Here's my response json. Can anyone help?
I should note that ActionOneIntent, ActionTwoIntent, and ActionThreeIntent are all configured properly in the action.json file, and work properly when invoked via a deep command to my service (ok google, ask my service to open action two).
I just can't get a response to this packet to work:
{
"conversation_token":"{REMOVED}",
"expect_user_response":true,
"expected_inputs":[
{
"input_prompt":{
"initial_prompts":[
{
"ssml":"<speak><p>Hello, would you like choice one, two, or three?</p></speak>"
}
]
},
"possible_intents":[
{
"intent":"AnswerOneIntent"
},
{
"intent":"AnswerTwoIntent"
},
{
"intent":"AnswerThreeIntent"
}
]
}
]
}
In the earliest version of the Actions SDK you could define "inDialogTriggers" as part of your Actions package. However, this was removed some time in December and the idea now is that developers process "assistant.intent.action.TEXT" which is the raw transcription of the user's input.
As such your only "possible intent" in the response should be "assistant.intent.action.TEXT" at this point. See here for reference: https://developers.google.com/actions/reference/conversation#http-response

How to use external file to handle push notifications in FirefoxOS?

I'm trying to get working Push Notifications on my FirefoxOS App. While it's working as expecte when the app is opened, when the app is closed it not works anymore. I thought that was the app is trying to execute the whole app instead only the handler so I'm trying to use the messages section on the manifest.webapp.
"messages": [
{ "push": "/push/push.html" },
{ "push-register" : "index.html" },
{ "notification": "index.html" }
],
My code on /push/push.html is:
<script>
navigator.mozSetMessageHandler('push', function () {
c = new Notification( 'testing 4' );
});
</script>
But it seems that's not loading the file when the push message arrives the device. For me, it doesn't seems to be a path problem, because I tried everything (launch path is /index.html, and I've tried moving push.html to the root and put /push.html).
Any clue?
Well, after hours trying it and a lot of research, seems that's not possible to get working the push in another page.
Remember: when a user selects an app, the lauch_path is displayed.
There’s a bug right now that restricts push notifications to the page
that calls register(). Right now, what’s under “messages” doesn’t
matter if it’s not the same as the page that calls register(). Keep
your eye on that bug if you want to know when it’s fixed. For now,
it’s probably a good idea to keep your app to one page and use dynamic
formatting to present info back to the user.
Firefox OS v1.1 only allows the page that registers for Push
Notifications to recieve them, so you cannot have / call
navigator.push.register() and have /push.html be the receiver that
uses navigator.mozSetMessageHandler().
More info about the bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=800431 [^]
https://bugzilla.mozilla.org/show_bug.cgi?id=897112 [^]

real time updates for facebook page blues

i am having a heck of a time getting facebook real time updates to work for a page. true, this question may have been asked - more than once - but i have not seen a definite routine given as an answer. mostly just disjointed suggestions. as a disclaimer - allow me to add i have read the documentation all over many times. you will see this when i post my routine. i am getting no updates after all of this.
create a page. named Testerthree, category : brands & products : app page, website : _http://< mydomain >.com, page id :
developers.facebook.com
i create an application : Testerthree
a. settings : Testerthree namespace : tester_three
b. create a platform : website : Site URL : Mobile Site URL : _http://< mydomain >.com
c. add a platform : page tab :
Page Tab Name : Testerthree Secure Page Tab URL : _http://< mydomain >.com
d. app domains : _http://< mydomain >.com
e. app details : i fill out all the info for the top box. category : apps for pages
this is where things get kinda weird. there's a button there under "App Page" to create a new page for the app....sometimes this works automatically and sometimes it doesnt. basically i do know now how to connect a page to this field. however erratic the process is. basically, listed here for "App Page" - is a page i created with the same name : Testerthree
app id : < app id > app secret : < app secret >
so at this point what i would have is a page : Testerthree
and an app : Testerthree
I have the page listed in the App Details page as the role of App Page
then i begin trying to get the requests to query and configure facebook. this process appears to work, and create a subscription, but nothing is ever sent from my page to my server through the app. if i subscribe to USER fields through the app, they update. if i subscribe to the PAGE fields, i get no update. either way, here goes :
get access token :
_https://graph.facebook.com/oauth/access_token?client_id=< app id >&client_secret=< app secret >&grant_type=client_credentials
not sure if this is needed, but it was a piece of the puzzle i never let go :
_https://graph.facebook.com/oauth/authorize?client_id=< app id >&redirect_uri=_http://< mydomain >.com/fb/return.php&scope=manage_pages,offline_access,read_stream
creating the subscription :
_https://graph.facebook.com/< app id >/subscriptions?access_token=&object=page&fields=feed,description,general_info&verify_token=&method=post&callback_url=_http://< mydomain >.com/fb/facebook-subscribe.php
now i DO have the entry point on my server at _http://< mydomain >.com/fb/facebook-subscribe.php
the code in it looks liike the code specified here (facebook-subscribe.php) :
http://mwc.byteshaman.us/fb/fbsubscribe-code.php
which should take any post data and output to a file. honestly prior to all this i put a small random fopen, to create an output txt file, if this .php is ever viewed or pinged. when i create the subscription, the txt is made. when i test my subscription, no txt is made.
either way
i check the subscription with this :
_https://graph.facebook.com/< app id >/subscriptions?access_token=&method=get
and it DOES show a subscription like this :
{
"data": [
{
"object": "page",
"callback_url": "_http://mydomain.com/fb/facebook-subscribe.php",
"fields": [
"description",
"feed",
"general_info"
],
"active": true
}
]
then i connect the page with the app with this :
_https://www.facebook.com/dialog/pagetab?app_id=< app id >&redirect_uri=http://< mydomain >.com/fb/return.php
this is an insane amount of steps to subscribe to a feed. cheers to facebook. someone please aim me in the direction to the part in their documentation where they give one complete cohesive example of any of this....
well, it appears as if i have a subscription setup after all this. the page is listed in my app details. the subscription is showing subscribed.
yet when i update my page feed, or change some of the description data (which is supposed to be subscribed to) I get nothing.
anyone please help?i've done all the homework possible, and this post is my last attempt after 3 days, before gaining the absolute belief that this routine is impossible and there's actually no such thing as realtime updates for facebook pages, like the Easter bunny, or Santa claus.
is it possible? does anyone know the routine? can anyone identify where i messed up?
thank you.
i have the answer : cron jobs. the facebook real time api is erratic when it comes to pages. the solution was to never use the facebook realtime update api and just use a cron job instead. thanks for playing. there was no winner or loser.