Openai node not passing telegram user ID

I’m working on a Telegram bot workflow in n8n where user messages trigger an OpenAI Assistant (OpenAI4 node) before responding via Telegram. However, the chatId (user ID) does not pass through OpenAI4 correctly, causing the Telegram node to fail when trying to send a response.

I have verified that the chatId reaches OpenAI4, but instead of returning the expected text response, OpenAI4 outputs a threadId. This causes the Telegram node to receive the wrong data structure, leading to a “Bad Request: chat not found” error.

  • n8n version: latest
  • Database (default: SQLite): N/A
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): desktop online
  • Operating system: mac

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I have had a similar issue when mapping back to a domain, and the domain was not passed throuhgh openAI node.

My fix was to add the domain (chatid in your case) into the prompt and explicitly tell the AI to include the chatid in the response as JSON.

Then you can map to the chatID out put from the openAI node.

Essentially forcing the chatID to be passed through

iit was quite siimple for me . I just add the ID from the telegram trigger using the map… and done ! :grinning:

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