Route the data depending on the trigger

Hello community,

I would like to route the data (Switch) depending on the webhook trigger.

Please any help ?

Thanks

Hey @TheG,

Which field in the webhook response would you be basing the routing on? I assume each webhook could make any one of those 4 hubspot calls and you don’t want to run one hubspot call from one trigger, If that is the case you can drop the switch node and go direct from Webhook to Hubspot.

Thank you for you answer @Jon


Please find above the real workflow that i’m working on, I have other nodes in between.
Yes I want to route depending to which webhook is triggered.

Thanks

Ah ok that makes things a bit trickier, I don’t think we have an option to get the triggering node. You might be able to use a code node to work out which node has output data and set an option that could then be used in the switch node for the routing.

… After starting to type that I thought I would go and have a play and I have worked out a solution. If you add a set node after the webhooks that they all feed into then set a variable called triggerNode (or whatever you want) then for the value set it to an expression and use {{ $prevNode.name }} this will then set triggerNode to be whatever the name is for the node that called it which in this case would be the node that triggered the workflow.

You can then use {{ $("Set").first().json.triggerNode }} anywhere in your workflow that you need to use that value.

You can find an example workflow below.

2 Likes

Aw that’s smart !
I tried it out but still having an empty return.

Do you have an idea why that happens ?

That is odd, When I run that workflow I get…

and in the set I have…

It does look like you are on an older version so it could be that an update will sort it out, I am not sure when prevNode was added but it could be that your version is from before it existed.

1 Like

Yeah it works!
I look the UI revamp !
Thanks

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.