I am new to n8n, and I am trying to create a workflow where, when I message my bot, my bot will relay the message to channels that my bot joined as admin
So for this purpose I am choose “message” in telegram trigger, however it looks like it triggered not only when user message it directly/direct message, but also when users posted something in the channel.
What is the correct way to do this? because this causing the cpu and memory usages to spike since the workflow processing all posts by users in different groups/channels, and the message that I send get delayed for a long time
What you are doing looks to be fine to me, How long are the messages being delayed by the running time seems fairly quick.
One thing I have noticed there is in your run screenshot you have 4 being kicked off in a single second, If that was to then send the message to multiple channels with a 1 second delay you are going to see a resource increase.
Running in Own mode likely won’t help either as that fires up a new internal process which can take up to 3 seconds (in my experience) that will increase the usage for each run so those 4 runs will potentially take 4+ seconds to actually send a message and each one will add to the resources being used.
To me that reads as it will trigger on any incoming message but looking at the Telegram API docs it doesn’t say if that is direct or from a channel. I have just done a quick test though as I was curious to know the answer and it looks like it is for both channels and direct.
If you only wanted to go for direct messages you would need to filter out the messages, It is a bit odd that there doesn’t seem to be an API option for direct messages in Telegram but it could be that I am missing it.