Add `MemoryChatInserter` Node to n8n Workflow


I propose the addition of a MemoryChatInserter node to the n8n workflow toolkit. This new node will serve as a complement to the existing MemoryChatRetriever and offer expanded capabilities for dynamic chat interactions within workflows.

Feature Details:

  • Node Name: MemoryChatInserter
  • Purpose: To insert chat messages and summaries into the workflow’s memory, enabling enhanced interaction and data handling in chat-related workflows.
  • Primary Function: Facilitates the insertion of chat messages and conversation summaries into the workflow’s in-memory database.
  • Inputs: Chat messages, conversation summaries, metadata (sender info, timestamps).
  • Outputs: Confirmation of message insertion and associated metadata.
  • Potential Use Cases:
    • Dynamic conversation flows and chatbot response testing.
    • Summarizing key points in ongoing conversations for quick reference.
    • Real-time updates and inserts into chat logs for better context and analysis.
    • Archiving and retrieving conversation data for auditing or analytical purposes.

Enhancing Conversation Summarization and In-Memory Use:

The MemoryChatInserter node can significantly improve the management of conversation data within workflows. Specifically:

  • Inserting Summaries: Users can insert summaries of lengthy conversations, providing quick and accessible overviews of chat content without needing to parse through entire conversation histories.
  • Efficient Memory Utilization: This node would make optimal use of in-workflow memory (InMemory) by enabling the dynamic insertion and updating of chat content, which is particularly useful in workflows involving continuous data streams or where context needs to be maintained over time.

Implementation Details:

  • Seamless integration with existing in-memory data structures.
  • Security and privacy considerations for data handling.
  • Comprehensive documentation and user guides for implementation.

Code Snippet Section:

Here is a basic implementation structure for the MemoryChatInserter node.

/* eslint-disable n8n-nodes-base/node-dirname-against-convention */
import {
    type IDataObject,
    type IExecuteFunctions,
    type INodeExecutionData,
    type INodeType,
    type INodeTypeDescription,
} from 'n8n-workflow';
import type { BaseChatMemory } from 'langchain/memory';
import type { BaseMessage } from 'langchain/schema';

export class MemoryChatInserter implements INodeType {
    description: INodeTypeDescription = {
        displayName: 'Chat Messages Inserter',
        name: 'memoryChatInserter',
        icon: 'fa:pen',
        group: ['transform'],
        version: 1,
        description: 'Insert chat messages into memory for use in the workflow',
        defaults: {
            name: 'Chat Messages Inserter',
        codex: {
            categories: ['AI'],
            subcategories: {
                AI: ['Miscellaneous'],
            resources: {
                primaryDocumentation: [
                    // Provide relevant documentation URL here
        inputs: [
                displayName: 'Memory',
                maxConnections: 1,
                type: NodeConnectionType.AiMemory,
                required: true,
        outputs: [NodeConnectionType.Main],
        properties: [
            // Define properties required for inserting messages

    async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
        this.logger.verbose('Executing Chat Memory Inserter');

        const memory = (await this.getInputConnectionData(NodeConnectionType.AiMemory, 0)) as
            | BaseChatMemory
            | undefined;

        // Logic to insert messages into memory
        // For example, you may retrieve messages from the input and add them to the memory

        return this.prepareOutputData(/* Output data based on the operation */);

    // Additional methods if required

Value Proposition:

The MemoryChatInserter node would be a valuable addition to n8n, especially for users who work extensively with chatbots, AI-driven conversation analysis, or any workflow that benefits from dynamic chat data manipulation. This feature would provide a more robust and versatile toolkit for managing and interacting with chat data in real time.

I hope you will consider this feature for implementation, as it would significantly enhance the capabilities of n8n’s workflow automation.