Switch node - is there a better way though?

I’m wondering whether there’s a better way of doing this?

Currently, i’m doing posts to multiple Facebook accounts, to warm them up. So, for the example, the only node change is at the end with the posting credentials with multiple HTTP nodes posting to the different Facebook Pages.

Currently I use a Switch node with an expression using a global variable out of a Code node per below -

Ideally, Switch node, in this case, would have a defined number of outputs and each one would trigger sequentially i.e first execution out of output 0, next execution output 1 and so on.

And the other issue with the way I’m doing it now is previous node variables aren’t able to be accessed after the Switch node which requires me to plug in Merge nodes after the Switch node.

Now all this works in a spaghetti node fashion. Just wondering if there’s better nodes or ideas to achieve the same result.

Anyone care to comment?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

You could use one HTTP node instead and map the authentication in the defined header dynamically.
So then you only have one code node followed by an HTTP node.

thanks for the reply
I don’t understand what you http node has to do with the switch node. the http nodes i’m using in the workflow are way way down the workflow chain and actually those are using dynamic credentials.
but each switch output is a different workflow
I’m looking for a replacement of sorts for the Switch.

Maybe this is better suited as a feature request as also having a random output would be useful as well.
Thanks for your reply too

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