Prevent unnecessary workflow executions with Slack event API

Hey everyone,

I have been toying around with n8n over the weekend as it seemed to be an interesting tool to use Slack to automate some knowledge management. I built a workflow that starts with a Webhook that listens to the Slack events API of our workspace. I set it up this way so that I can screen for triggers in Slack messages. Unfortunately, the downside is that it results in a lot of triggered executions that are stopped right away but still count towards the workflow execution limit. Is there a smarter way to do this or is this just not a use case for n8n?


Hey @arvidsens,
Actually there is no clear answer to your question. It depends on your use case.

If you need to get all events of your Slack workspace to analyse them programmatically then there are maybe some other options. I don’t know anything about the slack events api actually. Maybe there is an option to filter the event before the webhook is called. Another solution would be to create a webhook api on your own which will do the filtering before it calls n8n. I could recommend, if you want to stay in the open source low-code world for that kind of filtering service. Its still a bit of code though.

If your usecase is to start an workflow an a specific user message then you can create a slack slash command which triggers the n8n workflow via webhook. In that case the workflow is only triggered if the user really wants it.


Hi Nico,

Thanks so much for the swift response, much appreciated. I am still evaluating really. Right now, the workflow is triggered based on a hashtag or an emoji anywhere in a public channel or private channel that the Slack bot is a member of. So anyone on the team who wants to mark a post to be processed for knowledge management can easily do it using one of the two methods. This is unfortunately not something I can filter for on the API side, which leaves me with a bit of a firehose. Happy to create some kind of API myself if that solves the problem. Are you suggesting to place Windmill inbetween Slack and n8n? Just had a look at their website and the plans also seem to be based on executions. Do the define executions in a different way or might that just shift my problem? Appreciate any further input on this!!

Thanks again!

Edit: I do like that real-time way of doing this as it allows for immediate feedback to the user but I suppose I could also attempt to run a script on an interval that runs a search query or something similar.


you are totally right. That is just a shift of the problem. At the end you’ll need to reduce the webhook calls from slack at all.

As I don’t know the Slack api that good I could just give advise to create the slash command to mark a message. But actually I don’t know yet how to get the reference. I just saw I my Slack recently that it is possible to create message actions. Maybe thats something for you as well. (See picture)

I will also take I deeper look into this. Sounds interessting :slight_smile:

Well, I haven’t given up on the real-time version just yet :smile: Do you think using socket mode instead could be an option? I am not really familiar with the concept.

Otherwise I just checked, Slack does have API methods to search all messages and check reactions to messages so with a bit of looping in the workflow that should also do the trick I suppose. And then I could run it a couple times a day.

1 Like

Okay that was really nice actually.

This triggers the workflow via webhook.

That could be a real-time solution for you created with n8n without having to analyse all events.

In the Slack app settings yo uneed to go to shortcuts:

Works like a charm.



Thanks for this! This may actually be a good way to trigger some other actions I have a mind. I think I found a solution to my problem by putting a simple script on AWS Lambda that does most of the filtering and only passes on the events that are actually relevant for my workflow. Super simple to set up and if I understand it correctly, it is even for free, at least for the amount of requests I need to process. Thanks again for your help, I really appreciate it! :pray:


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