Hi,
I am building a Telegram bot + AI Agent workflow in n8n (v2.1.1 self-hosted).
Flow:
Telegram Trigger → AI Agent (Google Gemini Chat Model) → Send a text message
I am facing an issue in the Send a text message node. Telegram is returning this error:
Error:
Bad Request: chat not found (400)
I am using this expression for Chat ID:
{{$node["Telegram Trigger"].json.message.chat.id}}
The chat ID is clearly present in the input (it is a private chat), but the message still fails to send.
Parse Mode is set to HTML, and the message text is coming from the AI Agent output ({{$json.output}}).
I am confused about:
-
Why “chat not found” occurs even though the chat ID is correct
-
Whether there is a context or item mismatch after the AI Agent node
-
Or if the chat ID is not being passed correctly from the Telegram Trigger
Please help me understand:
-
The exact reason for this error
-
And the correct way / best practice to fix this issue when using AI Agent + Telegram in n8n
Thanks
