Azure Service Bus icon

Azure Service Bus

Send and receive messages from Azure Service Bus

Actions3

Overview

This node enables sending messages to an Azure Service Bus queue using either the official Azure SDK or the HTTP REST API. It is designed for scenarios where you need to integrate workflows with Azure messaging infrastructure, such as pushing event notifications, commands, or data payloads into a queue for asynchronous processing by other services.

Common use cases include:

  • Sending task or job requests to backend systems.
  • Triggering downstream processes via message queues.
  • Integrating cloud applications with Azure Service Bus for reliable message delivery.

For example, you can configure this node to send JSON-formatted messages containing order details to a queue named "orders" whenever a new order is created in your system.

Properties

Name Meaning
Protocol Protocol to use for Azure Service Bus connection:
- Azure SDK (Recommended)
- HTTP REST API (firewall-friendly)
Queue Name The name of the target queue to which the message will be sent.
Message Body The content/body of the message to send. Can be any string, typically JSON or plain text.
Session ID Optional session identifier for session-enabled queues/topics to group related messages.
Message Properties Custom key-value properties to attach to the message as application properties.
Content Type MIME type of the message body, e.g., application/json.
Message ID Optional unique identifier for the message to help with deduplication or tracking.

Output

The node outputs an array of JSON objects, one per input item processed, each containing:

  • success: Boolean indicating if the message was sent successfully.
  • messageId: The unique identifier of the sent message (if provided).
  • queueName: The name of the queue the message was sent to.
  • sentAt: ISO timestamp when the message was sent.

Example output item:

{
  "success": true,
  "messageId": "12345",
  "queueName": "my-queue",
  "sentAt": "2024-06-01T12:34:56.789Z"
}

No binary data output is produced by this operation.

Dependencies

  • Requires an Azure Service Bus connection string credential configured in n8n.
  • Supports two protocols:
    • Official Azure Service Bus SDK (@azure/service-bus), which requires WebSocket support.
    • HTTP REST API approach, which uses SAS token authentication and standard HTTP requests.
  • Uses node-fetch for HTTP requests when using the REST API protocol.
  • For SDK protocol, attempts to use WebSockets transport if available; otherwise falls back to default transport.

Troubleshooting

  • Missing or invalid connection string: The node throws an error if the Azure Service Bus connection string is missing or contains placeholder blank values. Ensure the connection string is correctly entered in credentials.
  • Empty message body: Sending a message with an empty or whitespace-only body results in an error. Always provide a non-empty message body.
  • Protocol mismatch: Some operations (like receiving messages or topic operations) are only supported with the SDK protocol. Using HTTP REST API for these will cause errors.
  • WebSocket issues: If WebSocket transport is unavailable, the node logs a warning and uses the default transport. This may affect connectivity depending on environment.
  • HTTP errors: When using the REST API protocol, HTTP errors from Azure Service Bus are logged and thrown with status codes and messages. Check network/firewall settings and SAS token validity.
  • Session ID usage: If using session-enabled queues/topics, ensure the session ID is correctly set; otherwise, messages may not be accepted.

Links and References

Discussion