How can I batch send the notification hub message to specific users using PNS token

Mike V 41 Reputation points
2021-08-05T01:56:01.53+00:00

Hello,

A bunch of devices are registered on my server. I have saved the mapping between device Id and PNS token, I have used the device Id as the installation ID to register template notification push on notification hub using installation method.

I have read the doc and saw that there is no such a way to target for specific token or installation ID.

This is the doc I read to send via template: https://video2.skills-academy.com/en-us/rest/api/notificationhubs/send-template-notification.

I noticed that the article(https://video2.skills-academy.com/en-us/azure/notification-hubs/notification-hubs-push-notification-registration-management) mentioned that I can actually send through instllation ID:

The installation model supports a special tag format ($InstallationId:{INSTALLATION_ID}) that enables sending a notification directly to the specific device. For example, if the app's code sets an installation ID of joe93developer for this particular device, a developer can target this device when sending a notification to the $InstallationId:{joe93developer} tag. This enables you to target a specific device without having to do any additional coding.

  • I would like to ask how can I target specific users and send message using installation method? I have seen people using tags, however I don't want to use this method because I cannot previously categorize the users into different tags.
  • I don't know if this is applicable for template notification by adding the installation ID to ServiceBusNotification-Tags in the header.
  • Will there be any batch Api that I can do so that I don't need to call the same API for many times?
  • I would also like ask will there be any method that I can push via specific token using template?

Thank you.

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
319 questions
0 comments No comments
{count} votes

Accepted answer
  1. SnehaAgrawal-MSFT 21,506 Reputation points
    2021-08-06T15:43:47.513+00:00

    Thanks for asking question!

    1. Targeting an installation/user ID is done via a special installation tag as mentioned in the docs below. If you create an installation using device token (or whatever value you like) abc, you target that user by targeting a special tag $InstallationId:abc.
      You do not need to add this tag themselves.
    2. Template notifications support tags, so targeting installation IDs is supported as well.
    3. There is no batch API for registration/installation-based sends. We do have a direct batch send API for native (non-template) direct sends which accepts up to 1000 devices: https://video2.skills-academy.com/en-us/rest/api/notificationhubs/direct-batch-send
    4. We don’t have a method for sending template notifications by device ID. See #1 above.

    Hope this helps.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.