vitorsj
September 3, 2025, 4:25am
1
TL;DR: When using AI Agent with Postgres Chat Memory , there’s no way to map the Session ID dynamically from the incoming payload (e.g. message.chat.id from Telegram or chatId from Chat Trigger). The From AI tab in the memory resource always shows “No input data,” so I can only use a fixed ID (“Define below”), which merges different users into the same conversation.
Context
Main node: AI Agent (with Use memory enabled).
Memory strategy: Postgres Chat Memory (default table n8n_chat_histories).
Triggers tested: Telegram Trigger and When chat message received (LangChain package).
Goal: persist per-user/per-session history, mapping a dynamic session identifier.
Expected behavior
Be able to set Session ID = From Input and select a field from the payload, e.g.:
{{$json.message.chat.id}} // Telegram
{{$json.chatId}} // Chat Trigger
{{$json.sessionId || $json.chatInputId}} // fallback
Observed behavior
Inside Postgres Chat Memory , the INPUT → From AI tab always shows “No input data” (even after executing previous nodes).
As a result, there are no JSON fields to select for Session ID .
The only option is “Define below” with a static value, which causes all chats to be stored in the same memory/session.
I attached a screenshot of the panel (INPUT tab showing “No input data”) for reference.
version: 1.109.1
N8N Cloud.
vitorsj:
When using AI Agent with Postgres Chat Memory , there’s no way to map the Session ID dynamically from the incoming payload (e.g. message.chat.id from Telegram or chatId from Chat Trigger). The From AI tab in the memory resource always shows “No input data,” so I can only use a fixed ID (“Define below”), which merges different users into the same conversation.
Context
Main node: AI Agent (with Use memory enabled).
Memory strategy: Postgres Chat Memory (default table n8n_chat_histories).
Triggers tested: Telegram Trigger and When chat message received (LangChain package).
Goal: persist per-user/per-session history, mapping a dynamic session identifier.
Expected behavior
Be able to set Session ID = From Input and select a field from the payload, e.g.:
{{$json.message.chat.id}} // Telegram
{{$json.chatId}} // Chat Trigger
{{$json.sessionId || $json.chatInputId}} // fallback
Observed behavior
Inside Postgres Chat Memory , the INPUT → From AI tab always shows “No input data” (even after executing previous nodes).
As a result, there are no JSON fields to select for Session ID .
The only option is “Define below” with a static value, which causes all chats to be stored in the same memory/session.
You have to concrete example of the expression to use, here is one for Telegram:
{{ $('Receive Message').item.json.message.chat.id }}
And for the Chat Trigger:
{{ $('When chat message received').item.json.sessionId }}
system
Closed
December 2, 2025, 7:19am
3
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.