Skip to main content

n8n + Memanto

n8n Add persistent memory to your n8n workflows using Memanto’s REST API. n8n workflows are stateless by default — each execution starts fresh. With Memanto, you can store context from one workflow run and recall it in future runs, giving your automations a memory that grows over time.

How It Works

Memanto exposes a simple REST API. In n8n, you call it using the built-in HTTP Request node — no custom code or plugins required.
Memanto authenticates with Moorcheh on the server using MOORCHEH_API_KEY. n8n nodes do not send an Authorization header. The only header you pass from n8n is X-Session-Token for memory operations.

Prerequisites

  • n8n (self-hosted or cloud)
  • Memanto server accessible from your n8n instance, with MOORCHEH_API_KEY configured in its environment

Step 1: Start Memanto Server

On your server or locally:
If n8n is running in the cloud or Docker, expose Memanto via a public URL or use a tunnel like ngrok.

Core Workflow Patterns

Pattern 1: Activate Session + Remember

Use this at the start of a workflow to open a session and store context. Node 1 — Activate Session (HTTP Request) This returns a session_token. Reference it in later nodes via:
Node 2 — Remember (HTTP Request)

Pattern 2: Recall Context

Retrieve relevant memories before making an LLM call or sending a response. Node — Recall (HTTP Request) The response contains a memories array. Access the first result with:
Or join all results into a single string using a Code node:

Pattern 3: AI-Powered Answer from Memory

Let Memanto answer a question directly using its built-in RAG: Node — Answer (HTTP Request) Returns answer — a grounded response based on stored memories, no external LLM call needed.

Example: Customer Support Workflow

This workflow receives a customer message via webhook, recalls past context, and sends a personalized reply.
Webhook Node — receives:
Activate SessionPOST /api/v2/agents/{{ $json.customer_id }}/activate Using the customer ID as the agent ID gives each customer their own isolated memory. Recall ContextPOST /api/v2/agents/{{ $json.customer_id }}/recall with body { "query": "{{ $json.message }}", "limit": 5 } Code Node — Format Prompt
OpenAI Node — use the formatted prompt to generate a reply. Remember ExchangePOST /api/v2/agents/.../remember with body { "content": "<message + reply>", "type": "fact" }

Memory Types in n8n

Set the type field in the Remember body to categorize what you store:

Sessions in Long-Running Workflows

Memanto auto-renews sessions that are near expiry on memory requests, so most workflows can simply reuse the token from the activation step. There is no separate /session/extend endpoint. For scheduled or long-lived workflows, the simplest pattern is to activate a fresh session at the start of each run rather than persisting the token between executions:
If a request returns 401 Unauthorized, re-run the Activate Session node and continue with the new token.

Next Steps