I'm actually implementing the push notification (https://developers.google.com/actions/assistant/updates/notifications) and I'm not sure to understand everything.
I'm using dialogflow through webhook json with php webservices, and meant to be used with google home (and phone).
All my tests are done through simulator.
I've created an intent get_store
I've created 2 implicits intents (notification_store and notification_text) and activated them as notification in the action console.
When I go into get_store, i'm asking a permission to send notification for notification_store (to send a gmap link), when the user respond yes, it returns me an UPDATES_USER_ID and set the user permission as true in all next requests.
Then, I use this UPDATES_USER_ID and the get_store to send the notification (it responds with a 200 ok)
Questions :
- Once I've accepted the permission, it will not ask me any new permission, even if I want to send notification for notification_text, which means it's one update permission for all notifications intents?
- I can't delete UpdatePermission from my user, even after using reset button or change version
- I have a doubt, does it work only with a released version (alpha/beta/prod) or even with a draft?
If someone can help me to understand what's possible so I could be able to know what is working, not working, not possible.
Thanks.
When you ask for permission to send push notifications, the UPDATE permission gets cached so you don't have to repeatedly ask the user for permission. However this permission is unique to the intent specified when asking for permission.
When asking for a user's permission to send push notifications, you must specify the implicit intent you are asking permission for. So in get_store, I imagine this intent is set to notification_store.
The following code uses the Node.js client library, but the concept is the same:
app.intent('get_store', (conv) => {
conv.ask(new UpdatePermission({intent: 'notification_store'}));
});
Because of this, you can't use get_store to ask for permission for notification_text. Instead you will need to create a separate intent such as get_text, which specifically asks for permission to send push notifications for notification_text.
Related
I've incorporated Firebase Cloud Messaging into my app. After messing around, I kind of understood the premise of how it operates. So, as a result, I structured my code so that when users sign up the FCM token is stored. After creating two accounts, I realise both FCM tokens for the user were the same.
Looked online and sorted this issue, and now I can refresh the token on launch, and still append the new FCM token when users initially sign up.
So now, I ask the question - Users are created with a fcmToken field (which I can refer to in my code), however, due to the fact a new token is generated on launch each time does this render the token(s) stored for each user useless? Or can I still push to the specific user using the fcmToken?
I've looked online, but can't seem to find an answer.
FCM tokens don't uniquely identify an individual end user. They identify a specific installation of an app on a specific device. When sending with that token, it doesn't matter who is signed in to the app (or if anyone is signed in at all) - the app will still receive it and need to figure out what to do with it. It's up to you to decide what to do with that message, given the sign-in state of the user. If you expect that your app could have multiple users sharing a single app on a single device, then you will probably want to send something in the payload to determine who that message was intended for, if necessary.
#doug great answer, but there's a common implementation problem when people share a device, so please add a warning, something like: often only the last logged in user should receive push notifications, otherwise he could see messages from the person who was logged in before. your backend should not only store all the devices a user is logged in, but also for each device who the last active user is and check this upon sending a push. the question whether you receive push or not when logged out is a common topic, too.
Just started playing with push notifications and I managed to handle all the subscription process and I'm saving endpoints and keys on my db. My questions is, what strategy should I follow, if any, to delete old subcription details from the database?.
So, if someone allowed notifications and they revoke the permission how do I know who did it to remove the details from the database?. Because if the user unsubscribes I'll just get a null subscription from pushManager.
For Pushpad we use these two strategies:
when a user revokes the permission the requests made using that endpoint will return 410 Gone and you should delete the endpoint
a developer can optionally trigger an unsubscribe with the Javascript SDK that will remove the endpoint from the server (this is useful for example to create a subscribe/unsubscribe button on the website)
i'm thinking about using Firebase for the notification service that my app needs. However, its important that the process of sending notifications is secure. I want to avoid a notification being sent from any member of the team without permission.
One way could be assigning restricted roles and permissions for the team members. However it also would be good to have any kind of activity log in the console, or have a log of all notifications sent including the name of the user. The console currently allows you to see all notifications sent, but i cannot see who sent it, and also the notification can be deleted from the log.
Any ideas on how to manage this? Which specific roles would you recommend me to use? Is it possible with Firebase?
You could write a function in Firebase which sends notifications, and you have logs on that function. Here is how to write a function which send notifications
With Firebase Cloud Messaging for Web,
How do I maintain the list of valid tokens in my database? For example I've noticed when a user turns off notifications and revisits the site, a new token will be generated and the old token in my database is useless.
I've also tried using Firebase messaging.onTokenRefresh() callback, but it does not get called when I turned off notifications. Also in this case, even if it did get triggered, it returns a new token that was refreshed. How do I keep track of the old token that was refreshed?
Can someone please share with me their thoughts/ways to maintain and ensure the token list in the database are valid or up-to-date?
Any feedback is much appreciated.
Thank you,
Christina
messaging.onTokenRefresh() is probably a wrapper around the event onpushsubscriptionchange.
Indeed that event is currently only called when the subscription is enabled (or enabled again), but not when the permission for push notifications is revoked. So at the moment you can only know that an endpoint has expired when you try to send a notification to it.
More details:
http://blog.pushpad.xyz/2016/05/the-push-api-and-its-wild-unsubscription-mechanism/
In any case you can use the callback to send any new token to the server: at first you will have two tokens stored for the same browser, one expired and the other valid.
Some problems arise if you have data associated to the endpoint (e.g. tag) that you want to preserve during the endpoint change: see the blog post for some suggestions.
I have developed an android application with the Parse push notification service and I can send notification from the Parse website.
How can I send push notifications through my own website using ASP.net? Is there any way?
I checked the Parse documentation but i get confused, I would really appreciate it if someone would help me.
Thanks
I ran into similar confusion. I wasn't even sure how to properly setup the user so that I could send a push notification directly to them. Then I found the following post:
Channels and Targeted Push Notifications
Note the last item under the Channels heading:
Most apps might find it useful to have a channel for each user so that
they can send messages to a user across all their devices and have
users follow others in the app.
So, now I know that I should subscribe each user to a channel that uniquely identifies the user (e.g., the 'bobsmith#foo.org' channel).
After I have subscribed the user to their channel, I can call Parse's REST API via my ASP.NET application. See Sending Pushes in the Parse REST API Developers Guide.
For an ASP.NET/C# example of how to submit a push notification check out this answer.