Unregister tags with Azure Service Bus Notification Hubs - notifications

I have inherited an iOS app that uses Azure Notification hubs to send notifications, however there is a snag.
The users select multiple categories for which to receive notifications (News, Sports, etc), and they can change these at any time. Whenever they add or delete an interest the app unregisters from the notification hub and subscribes with the new tags.
I thought that this was incorrect, but I can't find a way to see what tags a user is subscribed to, or add/delete a single tag.
In the current app, sometimes our test devices don't receive notifications that I think they should.
I've found answers online saying that you should avoid unregistering, and that there is a delay to register and unregister (such as the answer here, Android Azure Notification hub unregister)
I am looking for any insight on how to handle this usecase, of adding and deleting tags.

Since you didn't specify how you are communicating with the Azure Notification Hub, I will use the ANH REST API as reference.
"...I can't find a way to see what tags a user is subscribed to..."
If you request a registration (e.g. per registration ID), you will get the registration data including the assigned tags.
"...or add/delete a single tag."
You don't add or delete single tags directly on the registration in ANH, you basically update the whole registration, if necessary. Some ANH SDKs may have convenience methods for this, but in general, you just send the complete registration object with the desired tags to ANH and it gets overwritten. E.g. the REST API has an "Update Registration" method, but no "Add/Remove Tag" methods.
"I've found answers online saying that you should avoid unregistering, and that there is a delay to register and unregister..."
You should indeed not unregister and register for this use case because of the reasons you stated. This is probably also the reason for:
"In the current app, sometimes our test devices don't receive notifications that I think they should."
Never unregister and register again for updating a registration. Only unregister, if you don't want to receive notifications at all on a specific device.
"I am looking for any insight on how to handle this usecase, of adding and deleting tags."
Basically, just omit the "unregister step" and make the "register step" a "create or update registration step" using the actual ANH registration ID and all desired tags.

Related

Notifications for inactive users

I’m implementing a solution that will notify users in a scenario very similar to a chat.
I’ll be using SignalR and Azure Notifications Hub for the job.
There are two scenarios that I need to address:
Notifying users that are currently connected and using my app - either web or mobile
Notifying users who are NOT currently using the app
I think SignalR will work just fine for the first scenario which is fairly easy.
My question is handling the second scenario which will require Azure Notifications Hub.
In a typical chat app, though it’s not real-time, there’s little delay before an inactive user receives a notification for a new message he receives.
How do I “trigger” a process that will send a notification through Azure Notifications Hub?
I can think of two ways to handle this:
Figure out a way to keep a list of users who currently have an active connection to my app. These users can be notified through SignalR. So after each new message, I could trigger a notification process that will use Azure Notifications Hub for users who are NOT in the active users list i.e. those who are NOT actively connected to my app.
Another approach would be to assume no one is connected. I could create an Azure Functions app that runs every minute to check on messages that are NOT opened. It would then compile a list of users who need to be notified and call Azure Notifications Hub process to notify them.
I don’t want to reinvent the wheel and want to tap into the experience of those who’ve already implemented a solution like this.
I’m currently leaning towards the second approach. I’d appreciate your suggestions, especially on approaches that I haven’t thought of. Thanks!

Cloudkit new record notification

I am about ready to update my app with CloudKit new record notifications. before I publish it should I delete the subscription I used to test it?
You can delete it, yes. But if you are asking this question, you might be overlooking something with subscriptions.
I always create CloudKit subscriptions programmatically in my app when it starts up (through a method called from didFinishLaunchingWithOptions). I set a static name for the notification like taskNotification for each recordType so that the same subscription gets overwritten with each app launch.
This is useful because this code will run for every user on every device so that their devices gets registered to receive the notifications.
It also ensures the subscriptions get created in the Production environment on CloudKit after you migrate to it.
If you are manually creating and deleting CloudKit subscriptions, you may not be allowing your users to subscribe their devices properly. Just thought I'd point that out.
Good luck!

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.

Unable to get presence for people outside user's organisation in Skype for Business Web SDK

We are using the Skype for Business Web SDK in our application to show the presence of contacts.
When the contact is someone inside the user's organisation (and therefore the same AD instance as the user), we register a callback function on the contact's status onChange event and this works well.
However, when the contact is outside the user's organisation (and therefore a different AD instance to the user), we find that the contact's status onChange event never fires and so there is no way to know their status.
The code we are using is as follows:
skypeContactService.subscribeToStatusChange = function (contact) {
contact.status.changed(function (status) {
...
});
contact.status.subscribe();
};
I wouldn't have thought this is a deliberate security measure, because in Outlook Online's Skype for Business functionality you are able to see the presence of external contacts.
So perhaps this is a bug in the Skype for Business Web SDK? Or perhaps it is functionality that hasn't been implemented yet?
Would someone from Microsoft be able to clarify whether there is a plan to enable getting presence for contacts outside of the user's organisation?
Any help would be greatly appreciated!
Federation should be required to see presence and do conversation related activities like IM, Audio, Video. I am not an expert on this side of Skype/Lync, but I would suggest looking over the Federation Documentation as I would argue you have no link to the external users, so you would not be able to see that information.
To solve your exact problem you would need to have federation with any organization that you want to be able to see presence or start conversations.
It could be that they are federated with your organization so they can see your presence information or if they are hosted online (O365), it may be there are alternate APIs that expose presence information without being federated. Are they able to start an IM or A/V conversation with any of your users (it should fail because your side is not federated)?

Mailchimp API (v1.3): addresses added with listSubscribe() don't appear in dashboard

I'm using Mailchimp's API (v1.3) to add email addresses to a subscriber list on one of our sites. Obviously, I'm using listSubscribe() and everything is working fine, for the most part (read: API call returns true, all of the data I'm sending to Mailchimp gets added/updated correctly).
The problem, however, is that whenever a new address is added, the things that are normally supposed to happen (in particular: email notifications to list manager, addresses showing up in the dashboard list status stream) aren't happening.
I've looked around for quite a bit and haven't found anyone with the same issue. Any ideas?
The default action of listSubscribe to add a subscriber is opt-in. This means that when you submit a listSubscribe the subscribed user will get an email asking to confirm their opt-in.
If the user does not follow the link in the email then they will not appear in the dashboard.
You can bypass this by using:
'double_optin' => FALSE,
http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
However this is only recommended for very occasional circumstances (essentially where you are handling the opt-in).
In my case I am not activating a user account until they verify their email address. If let the opt-in email be sent then the user is going to get a number of emails from my web app. I'm being very careful to make sure that they're verifying their subscription and all subscription stuff is being processed by the web app (eg a user unsubscribes within the web app, not via MailChimp).
I talked to the Mailchimp support, and they said those actions won't happen using their public API; there is no way to trigger them.