Routing messages using a switch node
You can route messages to different branches of a flow by evaluating rules against:
- Message properties
- Flow properties
- Global properties
- Results of JSONata expressions
- Open Node-RED.
- Add a switch node from the function category to the workspace.
- Double-click the switch node to open the Edit node dialogue.
- In the Property drop-down list, select the property against which you want to evaluate rules.
- Add empty rules by clicking + add.

For each rule, an output is added to the switch node that corresponds to that rule.
- Configure the rules by selecting a rule type from the respective drop-down list and defining the rule as necessary.
- Select from the drop-down list whether the node should evaluate each rule every time and forward the message to all matching outputs or whether to stop evaluating after the first match.
- If new message sequences should be generated for each matching rule, enable the recreate message sequences check box.
- Click Done to apply your changes.
- Connect the input of the switch node to the node that outputs the messages you want to route.
- Connect the outputs of the switch node to the matching branches of the flow.
- Once the flow is deployed, messages are routed according to the rules.