Describe the problem
Currently, the Chat Memory Manager node only supports inserting messages by manually defining each message row (type + content) one by one in the UI. There is no way to pass a dynamic JSON array as input to insert messages programmatically.
This becomes a problem when:
- The chat history comes from an external source (e.g., an API or database) as a JSON array.
- The number of messages varies between executions.
- You need to hardcode a fixed number of index slots (e.g.,
$json.chatHistory[0]→$json.chatHistory[34]) to cover the maximum possible array length — and when the actual array is shorter, the remaining slots resolve toundefined, causing errors with LLMs like Gemini / Vertex AI that reject empty or null message content.
What I currently have to do
I use a Switch node to route to different Chat Memory Manager nodes depending on the expected history length (15, 25, or 35 messages), each with hardcoded index slots. This is fragile, hard to maintain, and still breaks when the array is shorter than expected.
What I would like
An option in Chat Memory Manager → Insert Messages mode to accept a JSON array as input, for example:
[
{ "role": "human", "content": "Hello" },
{ "role": "ai", "content": "Hi there!" }
]
So that the node dynamically inserts all messages from the array without requiring hardcoded index slots.