Create workflow based on error thrown by n8n

Hi team,

I am having troubles setting up a workflow on a certain condition.
My workflow creates a specific name&date channel based on a /command, but when that naming is used, the workflow clashes. (i.e. channel-2023-08-23).
I am working towards incrementing the channel name, so that I could get:

  • channel-2023-08-23
  • if channel-2023-08-23 used → channel-2023-08-23-01
  • if channel-2023-08-23-01 used → channel-2023-08-23-02
    At this point, if I trigger two times the worfklow, the second time I get “ERROR: Slack error response: {“ok”:false,“error”:“name_taken”}”

How can I use it in my workflow so I can continue building up incrementation? :slight_smile:

Hey @GabCo,

What about getting a list of the channels in your workflow and sorting them alphabetically and looking that way?

Another option could be to set the Slack node to continue on fail and increase a counter by 1 and loop back on itself like the example below.