Slack POST message to multiple channels at once

Hello,

It would be nice if it would be possible to automatically send a message to multiple channels using the slack node.
I end up with several slack nodes with exactly the same configuration just to send the message on several channels at the same time :

I know that the method chat.postMessage from the slack API doesn’t natively allow you to do that.
I think it would be very convenient to have a loop on sending the message if you pass a channel dictionary.

What do you think ?

Thanks for this great tool.

Jules

I guess I can also do an upstream function that returns my two channels :

return [
  {
    json: {
      chan: "#chan1"
    }
  },
   {
    json: {
       chan: "#chan2"
    }
  }
]

And then call the Slack node to make some kind of loop. It might be a little cleaner, but it doesn’t really solve my problem.

Hello @Jules_DUVIVIER welcome to the community!

Yes, makes sense. The thing would just be, that if one item would enter the Slack-Node, the output would have to consist of 3, as there would be 3 responses from Slack. Not sure if that could be confusing for people (honestly no idea). Definitely worth thinking about!

Yes, something similar like you described would be also this:

Hello @jan, thanks for your quick answer !

Yes sure, thank you. It’ll work and it’s cleaner. But at several points in my workflow I need to send a slack message to my 3 (or more) channels. So I have to have this function before each slack node.

Ideally I wish I could use my “Set” node to be able to define an array of channels and use this variable every time I call my slack node. I don’t know if my use-case is clear.

At the moment my workflow (my first one!) looks like this:

In my “Set vars” Node, I have defined two variables “Chan1” and “Chan2” that I use when I send a message but I have to duplicate my slack nodes.

(In my current workflow, I’m sending the message to 2 channels not 3)

For now you could “simply” create a separate workflow to send Slack-Messages with this workflow:

The Set-Node is only an Example and would be in the existing workflow. You would just have to send the data to the new Slack-Workflow the same way. Then instead of having a Slack-Node in exising workflow, you would have the Set-Node and the Execute Workflow-Node there.

Thanks, that sounds like a good workaround ! I’ll dig that, thank you!

You are welcome. Happy to help! But fixing that properly in the node in the short-term will be a good idea.