How To: Send scheduled notifications
If you have 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. Standard tier notification hubs support a feature that enables you to schedule notifications up to seven days in the future.
Schedule your notifications
When sending a notification, simply use the ScheduledNotification
class in the Notification Hubs 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));
Cancel scheduled notifications
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.
Next steps
See the following tutorials: