Onesignal: Web push notification for capture user votes - google-cloud-messaging

I am trying to implement a mechanism to push web notification to users and ask for their votes. I want to capture and store user's votes in my DB based on the feedback given.
For this purpose, I am using Onesignal's web push notification. I have managed to add a tag to each user to identify the user. So I can now send notifications to specific users. But when user clicks on the notification, I want to have the information about the notification like player-id, the actionid, notification id so that I can capture this information in my DB. I am not sure how I can get that.
Chrome and Firefox can support web push webhooks which may help, but I still don't have any solution for Safari. Can someone please suggest any alternatives or workarounds?
Thanks!

Related

Strategy for notification checking

Is there a recommended strategy for checking of notifications within my AngularJS app?
By 'notification' I'm talking about message alerts that are to be displayed to a user when they're logged into the application.
My plan is to notify the user of unread notifications in the app's NavBar as shown below:
My app communicates with my restFul API (written using Node.js, express, MongoDB), so I anticipate that new notification will be written to a MongoDB collection with details the user the notification is intended for.
What I'm unsure about is how the AngularJS application will check for notifications once a user is logged on. I could call my API for unread notifications every time the user navigates from one path to another but that seems simplistic and it wouldn't work if a new notification occurs whilst a user is viewing a page.
Another way would be some sort of timer system that checked, say, every 30 seconds. But this would results in unnecessary polling of my API when there aren't any new notification for a user.
So, wondering if there is a recommended strategy. Thanks for your help.
Polling is a solution but it is very inefficient. The solution to your problem are websockets. Websockets is a technology that provides a full-duplex bidirectional communication between your clients and your server. So you can send messages from your server to your connected clients. Your server maintains an array of connected clients and you just have to know which ID you need to send a message to it.
For your stack, the best solution I have came to is Socket.io http://socket.io
It also have cool features. For example, you can "observe" models, so if a model change in your database, for example an update to a user profile is made, you can trigger an event and automagically send a message to your client. This client get and handles the notification and do something, like put a badge on your alerts icon.
Hope this is useful for you.

send notification to a particular user with notification hub - Azure and GCM

I am a software developer in Xamarin - Android, I want to create notification messages. For this purpose I use Azure notification hub, combined with Google's service - Google Cloud Messaging (GCM).
My problem comes when I want to send notification to a particular user. I realized that I need to use the "TAGS" When I compose a new user to the system (Uniqe TAG)
Indeed, it works great, but when the user logged off his account, and then connect to another one (with another TAGS) - the TAGS of his old account are kept in a certain time, and he continues to receive personal messages from the previous account!!!!
Does anyone know what can be done about it?
thank you very much
This is actually an issue a lot of people/apps have on iOS and Android.
What you should do is:
Register your app at your Azure Notification Hub (ANH) on first start and reregister at every app start, to keep registration in sync
If a user logs in, update the registration with an additional tag for this user (e.g. "user:XY")
Sending notifications to that user tag will of course result in notifications on all devices the user is logged in on
If a user logs out, update the registration without the user tag (omit the user tag, so the registration doesn't have user tag anymore afterwards)
The registration will be updated immediately on ANH and sending notifications to the user (tag) will not result in notifications on that specific client
If the user can logout on your app without internet connection, you won't be able to update the registration of course and you will still have the problem of getting notifications for a logged out user. But as soon as another user logs in, the registration should get updated with the new user tag and everything should be fine again...
What you shouldn't do:
"Developers should never unregister the client app as a mechanism for logout or for switching between users..."

How would I reference a user account on bigcommerce so that they don't need 2 logins?

I have shop.domain.com, and in www.domain.com i have some social stuff going on with a blog, etc. I want users to be able to post comments on the blog, and use the social features without having to maintain 2 separate logins.
Can/should I use the webhook to capture their info when they register and send it my way?
I don't believe Webhooks are intended for what you are attempting to do. If you look at the events that Bigcommerce webhooks support
http://developer.bigcommerce.com/api/webhooks/quickstart
The majority of the events are transactional. You can subscribe for events when a customer is created, but there is no way for you to get a notification when somebody logs into your store.
Can't you include custom javascript in the store template that lets someone connect their Facebook or Twitter account, which can also be used to comment on your blog?

How to send invitation to facebook friend from my application

Hi I am working on Rails application. My application is currently in 'invitation only' mode. What I want to do is once user signed up to my application then user should be able to invite his Facebook friends to my application. So what is the best way to do it? I want to do similar like pinterest does. pinterest is also in invitation only mode. But still it allows my facebook friend to whom I have sent an invite to sign up directly. So how I can implement it in my application? Any guidance will be helpful..
Use the requests dialog:
http://developers.facebook.com/docs/reference/dialogs/requests/
Store the list of user id's you get back (which you need to do anyhow
to delete the request programmatically when the come to your app)
When a user tries to login to your app, ensure that they're on your
list of id's you stored earlier.
Delete their app request
See http://developers.facebook.com/docs/reference/dialogs
Deleting Requests When a user is directed to your application, by
clicking a Request from the application, the games dashboard, or from
a Request notification, you must delete the request after it has been
accepted. Requests are not automatically deleted once they have been
clicked, thus it is the developer’s responsibility to clear them once
they have been consumed.

iOS Push Notifications to specific user in the same deviceToken

I am using Urban Airship to test push notification and it went well.
My problem is how do I specify which user to get the notification not just the device token.
I mean in some situations where one device has multiple users, so many users registered the same device token to server.
Or do I have to do the filter on the device (client side) itself?
There's no real way to do what you want unfortunately. In APNS there's only such thing as a device. You push a device and it shows a message / badge / sound on that device.
If your app can have multiple users associated with it then you'd need to work out from the push which user it relates to and handle it accordingly. How you do that would depend on your app but you could add in a custom key to the push which indicated the user it's for.
If your app only ever has one user logged in at once then I suggest that when you hand the push token to your server, the server first turns off push for the user that the token was originally registered for and subsequently turns push on for the new user.