Actions on Google Push Notifications User Id - dialogflow-es

We make extensive use of push notifications in our Action for Google Assistant. Up until recently, we were able to use the notification id received from conv.argments.get('UPDATES_USER_ID') for new users and failing that we could conv.request.conversation.conversationId as an alternative.
If the user resets our Action on their Google Assistant, the original notification id is no longer valid. However, the notification id received for UPDATES_USER_ID post reset is generating an error "The caller does not have permission" with status "PERMISSION_DENIED". If we try to use the alternative, we get the error "Request contains an invalid argument" with status "INVALID_ARGUMENT".

We have been able to fix the issue by always relying on conv.request.conversation.conversationId as the push notification identifier for corresponding user. Although this entity's value changes with each user conversation, using the value supplied the first time seems to do the trick. Unfortunately, we could not find any documentation or community support on this.

Related

Is there a way to achieve the same behavior of sending notifications as email notifications using GitHub API?

I'm building a Telegram bot for myself that should send to me notifications when I get any. I'm trying to achieve the same behavior as GitHub's email notifications. The problem is that I'm not sure if it's even possible. I'm working with GitHub API for few days straight trying to solve this issue but I still have no idea how to do it. It's like GitHub API doesn't provide enough information about the notification.
For example, it provides field "reason", which describes why I got this notification but how to understand what this notification is about? Like, if I was assigned to the issue or pull request (right now it seems like notifications are the same whether I got assigned to the issue or got a new message in the assigned issue), or got a new message in a watching issue/pull request or anything else.

Actions on Google - Push notification to a user (userId strategy)

I am working on my push notifications to users and working through the documentation.
Following this walk through, I have set up a webhook to send a notification to a user, this notes a target.userId for the recipient. Question, what exact value is the referring to? Is this the userId I invent for a user, or is it something else?
Looking at userId documentation, it appears this has to be generated/maintained, and can go stale every 30 days of inactivity. Noted here
My concern is - users sending other users notifications. If the recipients userId has gone stale from what I've stored in my database, I assume the push notification will fail when trying to find that user by userId that expired? Is this the only way to target a user for a push notification? My assumption is yes based on this documentation - but it seems brittle - or unstable, since it rely's on an ID that can expire (unless i'm misunderstanding userId's).
Is what I've outlined above the correct way to think about push notifications from one user to another? I store the users ID in my database, and when a message is triggered ie: "tell JimBob that I'll be there at 11." i look through my DB to find JimBob and his saved userId, and then send JimBob the push Notification from MarySue.
I assume this also denotes that JimBob has to allow push notifications from the intent "receive_message".
In this case, you're misunderstanding the ID that is sent to you.
First - the UserID you reference is deprecated and scheduled to be removed later this year. And even when it wasn't deprecated, it would be unique and non-duplicated, so there was little chance of missends.
The ID that you need to use will be handed to you when the user approves the subscription. This will be in the arguments that are sent as part of the Intent where they approve it, and not with the request in general. When sent to you, you need to save this.

Dialogflow Webhook UpdatePermissions custom prompt

I'm currently trying to implement a prompt for push notifications in my dialogflow webhook. It works fine and sets the user up for push notifications if I implement it in the fashion described in the actions on google documentation (https://developers.google.com/actions/assistant/updates/notifications)
conv.ask(new UpdatePermission({
intent: 'send_notification'
}));
When the user activates this section of code they are prompted with
Is it okay if I send push notifications for my_updates_intent?
There is no problem with this message, however, I wish at the very least to prefix it with a message of my own so that I can display this prompt contextually, depending on where the user is within the conversational flow. For example:
Your email has been set. We can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?
Or
No problem, we wont send you an email. If you are interested, we can set up notifications to keep you informed. Is it okay if I send push notifications for my_updates_intent?
Using the Permission constructor, the one UpdatePermission inherits, I can set a context that allows me to do just this.
conv.ask(new Permission({
context: "So we can give you directions",
permissions: ['DEVICE_PRECISE_LOCATION'],
});
Which will respond with:
So we can give you directions, I'll just need to get your street address from Google. Is that ok?
The first half of that message being something I wrote, and the second half coming from Google based on the type of permission I am requesting.
Logically I assumed that perhaps I could approach this by using the base Permission constructor with the permissions set to UPDATE:
conv.ask(new Permission({
context: 'Your email has been set. We can set up notifications to keep you informed',
permissions: ['UPDATE'],
updatePermissionValueSpec: {
arguments: undefined,
intent: 'send_notification'
}
}));
This, however, responds just the same as the UpdatePermission constructor and completely ignores my context. I have not been able to find any documentation or online resource that addresses this issue. Is it at all possible? or am I missing something obvious?
After contacting the actions on google support, I learned that customisation of the UpdatePermission message is not currently possible.
From the support team:
Unfortunately, altering this message is not possible for updates and push notifications. I'm adding this to our system as a feedback.
Hopefully, this helps anyone else facing a similar issue.

How to send a response to dialogflow later

I am using dialogflow by google to create a bot.
When my user ask my bot for a report with several parameters, I need to create the report and send him the link to download it.
The report is created in about 1 minute. When I send the response (JSON(fulfillmentText = "my url")) of the POST request of my webhook, dialogflow send me an error : time out.
So I need to send immediately the message "Please wait..." and then, when the report is created, send to my user a new message with the url of my report.
I am trying to use the API V2 but I cannot find in the documentation a way to send a message to a user when the POST request is already done.
This is not possible, the interactions with Dialogflow agents are intended to be conversational and must be initiated by the user. The timeout for your fulfillments response is five seconds.
It would probably be a better user experience anyway if you get an email address from the user and send them the link there, either by asking for it with the #sys.email system entity (be aware of privacy issues though) or by using account linking.

Firebase (Google) Cloud Messaging (FCM, old GCM) - check message status

I'm trying to find a solution to ensure a push notification to my Chrome extension has been received before sending another one. IF it hasn't been received and another one should go, I would change its content to tell the user he has multiple new informations to check.
So I'm looking for a way to check the previous message status using its ID, or check the queue of messages if using a collapse key, before sending a new one. But I can't find anything related to this, except here : https://support.google.com/googleplay/android-developer/answer/2663268?hl=en there is FCM message status detailed, but no way to get them after the first response.
I am aware receipts can be implemented using XMPP but I would really prefer to remain on the regular HTTP protocol.
Thanks ahead for any help.
XMPP receipts would be the recommended way for you to get an ack that the message was delivered. You can also use the Play Developer console (Android developer console) to view statistics on the status of messages. However this will not be sufficient if you want to automatically resend, you would have to do this manually.

Resources