Workflow PubSub icon

Workflow PubSub

Publish an event that other workflows can subscribe to using `Workflow PubSub Trigger`

Overview

This node, named "Workflow PubSub," enables workflows to publish events that other workflows can subscribe to using a corresponding trigger node. It supports two main actions: publishing an event and listing all current subscribers to events.

Common scenarios include:

  • Broadcasting data or signals from one workflow to multiple others asynchronously.
  • Implementing event-driven architectures within n8n where workflows react to specific published events.
  • Debugging or monitoring by listing which event filters (subscribers) are currently active.

For example, you might use this node to publish a "user.signup" event with user details, which other workflows listen for to send welcome emails or update analytics.

Properties

Name Meaning
Action Choose between "Publish" (send an event to subscribers) or "List Subscribers" (view current event filters).
Event Name The name of the event to publish. Required when Action is "Publish".
Mode Determines how items are published:
- Run once with all items: sends all input items as a single event.
- Run once for each item: publishes each item individually as separate events.

Output

  • When publishing events, the node outputs the same input items unchanged.
  • When listing subscribers, the output is an array of JSON objects representing each subscriber's event filter information.
  • The json field in output items contains either the original input data (for publish) or subscriber details (for list).
  • No binary data is produced by this node.

Dependencies

  • This node relies on an internal global subscriber registry to manage event subscriptions.
  • No external API keys or services are required.
  • It requires the complementary "Workflow PubSub Trigger" node in other workflows to receive published events.

Troubleshooting

  • Unknown action error: Occurs if the "Action" parameter is set to a value other than "publish" or "list_subscribers". Ensure the action is correctly selected.
  • No subscribers receiving events: Verify that other workflows have active "Workflow PubSub Trigger" nodes subscribed to the event name being published.
  • Event name missing: When publishing, the event name must be provided; otherwise, the node will fail.
  • Mode confusion: Using "Run once for each item" with large datasets may cause performance issues due to many individual events being published.

Links and References

Discussion