What is Azure Notification Hubs?

Azure Notification Hubs provide an easy-to-use and scaled-out push engine that allows you to send notifications to any platform (iOS, Android, Windows, Kindle, Baidu, etc.) from any backend (cloud or on-premises). Notification Hubs works great for both enterprise and consumer scenarios. Here are a few example scenarios:

  • Send breaking news notifications to millions with low latency.
  • Send location-based coupons to interested user segments.
  • Send event-related notifications to users or groups for media/sports/finance/gaming applications.
  • Push promotional contents to applications to engage and market to customers.
  • Notify users of enterprise events like new messages and work items.
  • Send codes for multi-factor authentication.

What are push notifications?

Push notifications is a form of app-to-user communication where users of mobile apps are notified of certain desired information, usually in a pop-up or dialog box on a mobile device. Users generally choose to view or dismiss the message; choosing the former opens the mobile application that communicated the notification. Some notifications are silent - delivered behind the scenes for the app to process behind the scenes and decide what to do.

Push notifications are vital for consumer apps in increasing app engagement and usage, and for enterprise apps in communicating up-to-date business information. It's the best app-to-user communication because it is energy-efficient for mobile devices, flexible for the notifications senders, and available when corresponding applications are not active.

For more information on push notifications for a few popular platforms, see the following topics:

How push notifications work?

Push notifications are delivered through platform-specific infrastructures called Platform Notification Systems (PNSes). They offer barebone push functionalities to deliver a message to a device with a provided handle, and have no common interface. To send a notification to all customers across the Android, iOS, and Windows versions of an app, the developer must work with Apple Push Notification Service(APNS), Firebase Cloud Messaging(FCM), and Windows Notification Service(WNS) separately.

At a high level, here is how push works:

  1. An application decides it wants to receive notification, so it contacts PNS for the target platform where the app is running and requests a unique and temporary push handle. The handle type depends on the system (for example, WNS uses URIs while APNS uses tokens).
  2. The client app stores this handle in the app backend or provider.
  3. To send a push notification, the app backend contacts the PNS using the handle to target a specific client app.
  4. The PNS forwards the notification to the device specified by the handle.

Push notification workflow

The challenges of push notifications

PNSes are powerful. However, they leave much work to the app developer to implement even common push notification scenarios, such as broadcasting push notifications to segmented users.

Pushing notifications requires complex infrastructure that is unrelated to the application's main business logic. Some of the infrastructural challenges are:

  • Platform dependency
    • The backend requires complex and hard-to-maintain platform-dependent logic to send notifications to devices on various platforms as PNSes are not unified.
  • Scale
    • Per PNS guidelines, device tokens must be refreshed upon every app launch. The backend deals with a large amount of traffic and database access just to keep the tokens up-to-date. When the number of devices grows to hundreds, thousands, or millions, the cost of creating and maintaining this infrastructure is massive.
    • Most PNSes do not support broadcast to multiple devices. A simple broadcast to a million devices results in a million calls to the PNSes. Scaling this amount of traffic with minimal latency is nontrivial.
  • Routing
    • Though PNSes provide a way to send messages to devices, most apps notifications are targeted at users or interest groups. The backend must maintain a registry to associate devices with interest groups, users, properties, etc. This overhead adds to the time to market and maintenance costs of an app.

Why use Azure Notification Hubs?

Notification Hubs eliminates all complexities associated with pushing notifications on your own from your app backend. Its multi-platform, scaled-out push notification infrastructure reduces push-related coding and simplifies your backend. With Notification Hubs, devices are merely responsible for registering their PNS handles with a hub, while the backend sends messages to users or interest groups, as shown in the following figure:

Notification Hub diagram

Notification hubs is your ready-to-use push engine with the following advantages:

  • Cross platforms
    • Support for all major push platforms including iOS, Android, Windows, and Kindle and Baidu.
    • A common interface to push to all platforms in platform-specific or platform-independent formats with no platform-specific work.
    • Device handle management in one place.
  • Cross backends
    • Cloud or on-premises
    • .NET, Node.js, Java, Python, etc.
  • Rich set of delivery patterns
    • Broadcast to one or multiple platforms: You can instantly broadcast to millions of devices across platforms with a single API call.
    • Push to device: You can target notifications to individual devices.
    • Push to user: Tags and templates features help you reach all cross-platform devices of a user.
    • Push to segment with dynamic tags: Tags feature helps you segment devices and push to them according to your needs, whether you are sending to one segment or an expression of segments (For example, active AND lives in Seattle NOT new user). Instead of being restricted to pub-sub, you can update device tags anywhere and anytime.
    • Localized push: Templates feature helps achieve localization without affecting backend code.
    • Silent push: You can enable the push-to-pull pattern by sending silent notifications to devices and triggering them to complete certain pulls or actions.
    • Scheduled push: You can schedule to send out notifications anytime.
    • Direct push: You can skip registering devices with the Notification Hubs service and directly batch push to a list of device handles.
    • Personalized push: Device push variables helps you send device-specific personalized push notifications with customized key-value pairs.
  • Rich telemetry
    • General push, device, error, and operation telemetry are available in the Azure portal and programmatically.
    • Per Message Telemetry tracks each push from your initial request call to the Notification Hubs service successfully batching the pushes out.
    • Platform Notification System Feedback communicates all feedback from Platform Notification Systems to assist in debugging.
  • Scalability
    • Send fast messages to millions of devices without rearchitecting or device sharding.
  • Security
    • Shared Access Secret (SAS) or federated authentication.

Next steps

Get started with creating and using a notification hub by following the Tutorial: Push notifications to mobile applications.