Telegram Trigger to relay message to several channels

Describe the issue/error/question

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 is the error message (if any)?

Please share the workflow

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:0.187.2
  • **Database you’re using (default: SQLite):default
  • **Running n8n with the execution process [own(default), main]:default
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]:docker

Hey @adi_alamsz,

Welcome to the community :raised_hands:

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.

As a quick test try changing the execution process to main and see if that helps, You can find more information about the execution types here: Execution modes and processes - n8n Documentation

Thanks for the prompt response @Jon , and thanks for pointing on how to improve performance. I’ll try your suggestion to improve the performance.

However, I think my problem is somewhat different, which I am not sure that I understand the telegram-trigger correctly

From the documentation

  • message: Trigger on a new incoming message of any kind- text, photo, sticker, etc

if I choose message, I assume when bot is DMed (direct message), it will then the worfklow triggerred, is my understanding correct?

If yes, the weird part is that it triggered when receives a lot of message which does not look like DM, but some users posts in channel

If no, then how I could make the telegram-trigger only triggered on a specific process such as DM

Thanks

Hey @adi_alamsz,

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.