Azure Notification Hubs icon

Azure Notification Hubs

Sends notifications to an Azure Notification Hub

Overview

This node integrates with Azure Notification Hubs to send push notifications to devices registered in an Azure Notification Hub. It supports multiple sending methods including broadcasting to all devices, targeting specific audiences via tags, sending directly to a device handle, and scheduling notifications for future delivery.

Common scenarios where this node is beneficial include:

  • Sending promotional or alert notifications to all users of a mobile app.
  • Targeting segmented user groups based on tags (e.g., users interested in sports).
  • Sending personalized notifications to individual devices.
  • Scheduling notifications to be sent at a specific future time, such as reminders or timed campaigns.

Practical examples:

  • Broadcasting a new product launch notification to all app users.
  • Sending a targeted message to users tagged as "premium" customers.
  • Delivering a direct notification to a user's specific device after a transaction.
  • Scheduling a notification to remind users about an upcoming event tomorrow morning.

Properties

Name Meaning
Send Type Method of sending the notification. Options:
- Audience: Sends to a specific audience using tags.
- Broadcast: Sends to all registered devices.
- Direct: Sends to a specific device handle.
- Scheduled: Sends at a specified future time.
Send Time The date and time to send the notification. Required only if Send Type is "Scheduled".
Platform Target platform(s) for the notification. Currently only "All Registered Platforms" is supported, meaning the notification will be sent to all devices on all platforms configured in the hub.
Audience Tags Tags identifying notification subscribers. Accepts one or more entries, comma-separated lists, or tag expressions. Used when Send Type is "Audience" or "Scheduled". Each item is treated as a group.
Device Handle The unique device handle to send the notification to. Required only if Send Type is "Direct".
Use Raw Message Boolean flag indicating whether to use a raw JSON message template. If true, the notification payload is provided as raw JSON data.
Template Data (JSON) The JSON string containing the data to apply to the notification template. Required if "Use Raw Message" is true.
Title Notification title (placeholder; currently not functional). Displayed only if "Use Raw Message" is false.
Subtitle Optional subtitle for the notification (only for certain platforms). Placeholder, not functional currently.
Message Notification message body (placeholder; currently not functional).
Icon Icon to display with the notification (placeholder; currently not functional).
Play Sound Whether to play a sound with the notification (placeholder; currently not functional).
Sound Name Name of the sound to play if enabled (placeholder; currently not functional).
Include Custom Data Whether to include custom data in the notification payload (placeholder; currently not functional).
Custom Data Custom data JSON string included in the notification payload if enabled (placeholder; currently not functional).

Note: Only raw notifications are currently supported. Other properties related to non-raw notifications are placeholders and do not function at this time.

Output

The node outputs a JSON object containing details about the notification send operation:

  • correlationId: Identifier correlating the notification request.
  • trackingId: Tracking identifier for the notification.
  • notificationId: Unique ID of the notification (may be null if unavailable).
  • successCount: Number of successful deliveries.
  • failureCount: Number of failed deliveries.
  • results: Detailed results per device or target.
  • state: Current state of the notification.

This output allows users to track the status and outcome of their notification sends.

The node does not output binary data.

Dependencies

  • Requires an Azure Notification Hub connection, authenticated via an API key credential.
  • Uses the official Azure Notification Hubs SDK (@azure/notification-hubs) to interact with the service.
  • The node expects valid credentials configured in n8n for accessing the Azure Notification Hub.

Troubleshooting

  • Missing or invalid device handle error: When sending directly to a device, if the device handle is missing or not registered, the node throws an error indicating the issue. Ensure the device handle is correct and registered in the Azure Notification Hub.
  • No audience tags specified: For audience sends, if no tags or tag expressions are provided, the node throws an error instructing to specify at least one tag or use broadcast instead.
  • Scheduled time in the past: When scheduling notifications, the node validates that the scheduled time is in the future. Setting a past time will cause an error.
  • Raw JSON parsing errors: The node expects valid JSON in the "Template Data" field when using raw messages. Invalid JSON will cause parsing errors.
  • General API errors: Any other errors from the Azure Notification Hubs service will be propagated. Check credentials, network connectivity, and Azure service status.

Links and References

Discussion