Push Notifications Using Notification Hub and .NET Web API as Backend - ios

I am working on a project where I have implemented web API with asp.net identity to authenticate users. An iPhone app will be accessing this web API in order to perform several tasks like authorization using identity db, subscribe to groups etc.
I am going to publish this web API in windows azure and going to use Azure notification hub for sending the notifications. Now in my iPhone app the user can subscribe to one or more groups to get notified to that group events. i.e A user can subscribe to "Cricket" and "Math" group in order to receive the notifications of that groups. So these groups really becomes Tags for the notification hub.
Now my question is There are two ways to register device to notification hub.
1) using app itself
2) using the web API that I have created.
I want to follow the second approach. I want the users devices to be registered to notification hub through my web API.
How can I achieve that? I didn't found any satisfactory code snippet for this purpose. Can any one provide me better clarification or code snippet on this?
Thanks

you can refer to the following link- http://www.ankitblog.com/2014/11/azure-notificationhub-sending-push.html and http://www.codeproject.com/Tips/845491/Azure-Notificationhub-Sending-Push-Notification-to for details of that. Its fairly simple

Related

Microsoft Teams subscription

Our company now uses ms teams. Whenever an incomming or outgoing call is made the name of the company or customer is not displayed in teams. So I need to display details to that call in a custom app. Therefore I wanted to use the callRecord subscription.
But in order to get the subscription working with my app, I need to have an API that gets all the subscription calls and provides the data via websockets to my app, right?
Isn't it possible that the app gets the subscriptions?
Today Microsoft graph change notifications only support delivering the change notifications gtuys webhooks/http post.
If you want those change notifications to be delivered to your front end application via Web sockets, you need to build your own backend solution to receive the change notifications via http post and relay it via Web sockets. Additionally you can request the feature on uservoice

Posting to a teams channel from a logic app or flow which includes an banner alert / activity feed item

I have a logic app which posts a channel chat message to teams automatically when a new item is created in SharePoint. This I have working but our client requires that all the team members receive a banner alert and activity feed which I am having a lot of difficulty with.
What I've already tried...
Using a Incoming web hook on the teams channel - this was a very simple way to post from the logic app but the incoming webhook don't seem to support mentions.
Using the msft graph api - The /team/channel/message endpoint can post messages and user mentions but the this endpoint doesnt support channel or team mentions. It also appears that the graph API needs to use delegated permissions to post messages in teams. I'm using application permissions as this is a logic app. The logic app HTTP post connector doesnt offer the "connect as username#tenant.com" some of the other connectors use.
Using the flowbot post message - Like the above channel and team mentions are supported here so the post is added to the channel but with no notification to the team members
Using a notification only bot - I thought I nearly had it with this one. Microsoft's node bot sample number 57 looked like it can do most of what I want, it iterates through the users in the team and messages them this a customisable alert message...
https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/57.teams-conversation-bot
However I can't see how this bot can be triggered from my logic app as it seems to require an existing conversation context or an #mention from within teams to start communicating with users.
What I'm considering trying next
Iterating users within the logic app - Next I plan to try and get team membership from the graph API and iterate the members in the Logic App, posting a message to each user separately. I had hoped to utilise the group #mention feature as a simpler way so I'd be grateful if anyone had any thoughts on other ways of doing this, or maybe there's something wrong with what I've already tried that you could give me some expertise on.
Thanks in advance ;)
Andy
You're on the right track with the Bot, but you're wanting to send something called a "Pro-active" message. You need the bot registered in the channel in order to get access to a few key properties (conversation id, service url, etc.), but you can use those to send a message from -outside- your bot (e.g. in an Azure Function). You might be able to do this directly from a Logic App, but I haven't tested that specifically.
To find out more, see my answer at Programmatically sending a message to a bot in Microsoft Teams but I've also got a recent blog post that you might find interesting for background on this at How Bots Actually Work.
Hope that helps
You can use Graph to post a message in 1:1 chat as long as you have the chat it. You can find the answer in this post Send message to personal Chat via Graph API
You can also call Graph API from Logic Apps. (https://techcommunity.microsoft.com/t5/integrations-on-azure-blog/calling-graph-api-from-azure-logic-apps-using-delegated/ba-p/1997666#:~:text=Calling%20Graph%20API%20from%20Azure%20Logic%20Apps%20using,Manage%20-%3E%20Certificates%20%26%20secrets%20More%20items...%20)

Azure App Service Push - registration endpoint

Im trying to implement push notifications on Xamarin iOS project using Azure App Service Push, and I'm having problems with device failing to register.
The confusing part is this:
I've read https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter5/concepts/
and it basically says that
The /push/installations endpoint is part of App Service Push - a feature of the Azure App Service resource. This exists on your .azurewebsites.net domain. It is not part of Notification Hubs.
However, according to this post:
https://blogs.msdn.microsoft.com/appserviceteam/2017/01/10/azure-mobile-apps-net-sdk-releases/
.AddPushNotifications() (which actually adds /push/installations endpoint)is now deprecated:
You should use the App Service Push endpoint instead. In your ASP.NET Owin Startup class, you can remove the reference to .AddPushNotifications() from the configuration.
Details here:
https://github.com/Azure/azure-mobile-apps-net-server/wiki/What-is-a-Default-Configuration%3F
If I understand correctly my App Service Mobile App, once connected to Push via Notification hub should expose some kind of endpoint for device registration but I find it unclear what that endpoint is and do i need to manually create it in mobile backend app?
.AddPushNotifications() is used to support the Azure Notification Hubs push registration endpoint via the Microsoft.Azure.Mobile.Server.Notifications package, you could check the NotificationInstallationsController.cs under the previous package. And at this point, you need to specific the Microsoft.Azure.NotificationHubs.ConnectionString app setting with the value for the connection string to your notification hub.
While the App Service Push is a feature provided by Azure Portal, and you need to go to your app service and click "Settings > Push", then choose your notification hub for your app, more details you could refer to here.
For your mobile client, you could leverage the extension method GetPush for IMobileServiceClient under MobileServiceClientExtensions.cs and the PushHttpClient.cs to send requests against push/installations for you. For more detailed code snippet, you could refer to here. Also, you could refer to adrian hall's book about using the .InvokeApiAsync() method.

How to achieve twitter like push notification via AWS SNS?

Is there a way to achieve twitter like push notification via AWS SNS?
SNS send notification to the user when something is happen him or her?
As i know the best way is to create a topic per user.
When user relate event happened,we publish a notification to the topic.
As AWS described the max topic number is 100,000 per account currently.
What if i've 1,000,000 users, it will not work.
Is there a more scalable scheme?
beeth0ven,
SNS supports publishing to a Topic of subscribed device endpoints or direct publishing to individual endpoints. In your case, you'll want to implement direct publishing to each individual endpoint. This allows more control and personal engagement but also means that you'll need to manage those endpoints in your own database and associate each endpoint to a user of your mobile app. Instead of publishing to a TopicArn, you'll publish individual messages to a TargetArn, which is the SNS Platform Endpoint that represents an app and mobile device. TargetArn is also the same call to send an SMS message to an individual phone number.
SNS Publish CLI: (see --target-arn)
http://docs.aws.amazon.com/cli/latest/reference/sns/publish.html
Direct Publishing via the Console:
http://docs.aws.amazon.com/sns/latest/dg/mobile-push-send-directmobile.html

What is the most efficient way to create end-points for an Amazon SNS service?

I am using Amazon SNS Service for an iOS application that needs push notifications.
I have figured most of the things, except for the part where I have to register my device tokens.
This is where Amazon talks about it. It can be done manually or with the help of createPlatformEndpoint API which they obviously recommend for bulk uploads. My question is how we can directly register tokens from devices that will install the app later on. The documentation talks about a proxy server which I would want to avoid as of now. Isn't there a direct way of doing this, like where I can directly call a method and push the device token received in the application to my SNS Platform?
This, is a possible duplicate except that it is in reference to Android.
The AWS Mobile SDKs support accessing SNS directly from the mobile device. If you're interested in seeing code demonstrating this on iOS, we included some as a sample we prepared for re:Invent 2013 called Mobile Photo Share.
The important thing to note when accessing SNS directly from the mobile device is that you'll want to restrict the credentials delivered to the device to only those services and resources you'll need to access. You can accomplish this via web identity federation or a token vending machine with appropriately restricted policy.
If you want to learn more about the Mobile Photo Share app, we had two talks at re:Invent about the app and its architecture. The video and slides for those talks are available here:
Building Cloud-Backed Mobile Apps
Integrating Social Login Into Mobile Apps

Resources