I’m starting to use the new AI Agents UI for my Telegram agents. When I’m trying to add a new Telegram message reply tool, it asks me for a reply chat ID. The only way I can set the chat ID is to hardcode it. (Or ask the AI to input this ID, which is a big NO-NO for security reasons). It seems to me that this flow is not properly designed…
Hey @Yevhen_Dyachenko, while you wait for a response, here are some things that might help:
Suggested resources
Automatically matched to your question.
Docs:
Forum:
@Wouter_Nigrini, @Ventsislav_Minev - you’ve helped with similar issues before, can you take a look?
Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.
Hey @Yevhen_Dyachenko , welcome to the n8n community Yes you’re right not to let the model fill that in, and you don’t need to hardcode it either. The Telegram node tool is meant for Telegram as a backend step. It only sees what the model passes it, so it can’t know which chat the message came from.
For replies, use the bot as the agent’s trigger instead. If it isn’t connected yet, go to Triggers > Add trigger > Telegram, pick your Silvia bot credential and Connect. The agent’s answer then goes back to the chat it came from, and it gets a built-in respond action that targets the incoming conversation, so the chat ID never passes through the model and you can drop this tool.
Keep the node tool only for sending somewhere fixed, like an alerts group, where hardcoding the chat ID is the right call anyway.
To pass the Chat ID securely without letting the LLM guess it or hardcoding it, map the Chat ID from your trigger node context into an execution parameter or workflow static data that the agent tool can reference dynamically via expression. Let me know how your trigger is structured and I can help outline the exact expression syntax for your Telegram tool node right here.
Hi Yevhen,
You are right not to let the model fill that in. Chat ID is routing data, not something the model should decide.
Split it into two cases:
- Replying to the person who triggered the agent: do not add a separate Telegram send tool for that reply if you can avoid it. Use Telegram as the agent’s trigger instead, and take the chat ID from the trigger payload itself, not from the model. That way the reply always goes back to the chat that just wrote to you.
- Sending to a fixed destination, such as an alerts group: hardcoding the chat ID there is actually fine. A chat ID is not a credential, it is just an address. The risk is only when the model can change it at runtime, so keep it as a fixed value or a workflow input, never as a $fromAI parameter.
To find the ID reliably, send a message to the bot first, then check the incoming update for that chat — that is the value to use for testing. Test with the fixed value first, confirm the message lands in the right chat, and only then switch that field to the trigger value if you need it dynamic.
If the Agents UI does not expose the trigger value in that tool field, that is a UI limitation worth reporting as a bug, not a reason to hand the ID to the model.
Thanks,
Mohsin
Exactly. My push here was to find an official way to access the Agent’s trigger node output parameters. I need to send a message in the middle of a loop. Kinda “Accessing the Web…” and call the web tool.
Hi @Yevhen_Dyachenko, for that mid-loop status, use the Telegram channel’s built-in respond action with a display-only card. In 2.45.4, it selects the current conversation internally, without taking a Chat ID argument.
With Telegram connected as an agent channel, add an instruction like: “Before calling the web tool, use Telegram’s respond action to send a display-only card with a section saying Accessing the web…, then continue with the web tool.”
Test from an incoming Telegram message. The card detail matters because text-only respond to the automatically replied conversation is rejected in that version. A display-only card doesn’t wait for a button response. If that action isn’t available, please share your exact n8n version.
