azurenotificationswindows-phone-8.1backendwns

How to send Raw notification to azure notification hub


I'm new to azure, i've already configured my app to receive raw notification and i'm able to receive them from the debug page of azure website, my question is, how can i send them from my backend? i'm able to send all type of notification but can't figure out how to send that type... A really simple one like the azure one (Windows one not Windows phone one), just one not formatted string


Solution

  • Asuming you are using WNS (and not MPNS), you simply call SendRaw from the hub.wns object. The syntax is:

    sendRaw(tags, payload, optionsOrCallbackopt, callback)
    

    See the NodeJS docs for the WNS service in Push Notification hubs at http://dl.windowsazure.com/nodedocs/WnsService.html.

    For a .NET backend, you use NotificationHubClient.SendNotificationAsync as documented at https://msdn.microsoft.com/en-us/library/azure/dn369343.aspx. The notification class you feed in will be a WindowsNotification as described at https://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.notifications.windowsnotification.aspx.

    Since you want to send a raw notification, you have to create the payload yourself. The documentation on how to create a raw payload is at https://msdn.microsoft.com/en-us/library/windows/apps/jj676791.aspx, and more specifically: