How To: Send Scheduled Notifications

Consider a scenario in which you want to send a notification at some point in the future, but do not have an easy way to wake up your back-end code to send the notification. When in Standard tier, Notification Hubs supports a feature that enables you to schedule notifications up to 7 days in the future.

When sending a notification, simply use the ScheduleNotificationAsync method in the Azure SDK as shown in the following example:

Notification notification = new AppleNotification("{\"aps\":{\"alert\":\"Happy birthday!\"}}");
var scheduled = await hub.ScheduleNotificationAsync(notification, new DateTime(2014, 7, 19, 0, 0, 0));

Also, you can cancel a previously scheduled notification using its notificationId:

await hub.CancelNotificationAsync(scheduled.ScheduledNotificationId);

There are no limits on the number of scheduled notifications you can send.