n8n + MEMANTO
How It Works
Prerequisites
- n8n (self-hosted or cloud)
- Moorcheh API key
- MEMANTO server accessible from your n8n instance
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.
Step 2: Store Your API Key in n8n
- Go to Settings > Credentials > New Credential
- Choose Header Auth
- Set Name:
MEMANTO Auth - Set Header Name:
Authorization - Set Header Value:
Bearer mk_your_api_key
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)| Field | Value |
|---|---|
| Method | POST |
| URL | http://your-memanto-server:8000/api/v2/agents/n8n-agent/activate |
| Authentication | Header Auth → MEMANTO Auth |
session_token. Use an Expression in later nodes to reference it:
| Field | Value |
|---|---|
| Method | POST |
| URL | http://your-memanto-server:8000/api/v2/agents/n8n-agent/remember |
| Authentication | Header Auth → MEMANTO Auth |
| Additional Headers | X-Session-Token: {{ $node["Activate Session"].json.session_token }} |
| Query Parameters | memory_type: fact |
| Query Parameters | content: {{ $json.message }} (or any field from your trigger) |
Pattern 2: Recall Context
Retrieve relevant memories before making an LLM call or sending a response. Node — Recall (HTTP Request)| Field | Value |
|---|---|
| Method | GET |
| URL | http://your-memanto-server:8000/api/v2/agents/n8n-agent/recall |
| Authentication | Header Auth → MEMANTO Auth |
| Additional Headers | X-Session-Token: {{ $node["Activate Session"].json.session_token }} |
| Query Parameters | query: {{ $json.userMessage }} |
| Query Parameters | limit: 5 |
memories array. Access the first result with:
Pattern 3: AI-Powered Answer from Memory
Let MEMANTO answer a question directly using its built-in RAG: Node — Answer (HTTP Request)| Field | Value |
|---|---|
| Method | POST |
| URL | http://your-memanto-server:8000/api/v2/agents/n8n-agent/answer |
| Authentication | Header Auth → MEMANTO Auth |
| Additional Headers | X-Session-Token: {{ $node["Activate Session"].json.session_token }} |
| Query Parameters | question: {{ $json.question }} |
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./api/v2/agents/{{ $json.customer_id }}/activate
Using the customer ID as the agent ID gives each customer their own isolated memory.
Recall Context — GET /api/v2/agents/{{ $json.customer_id }}/recall
- query:
{{ $json.message }}
/api/v2/agents/.../remember
- content: the customer’s message and the agent’s reply
Memory Types in n8n
Set thememory_type query parameter in your Remember node to categorize what you store:
| Type | When to use |
|---|---|
fact | Objective information about the user or entity |
preference | User likes, dislikes, or settings |
decision | Choices made during the workflow |
commitment | Promises or follow-up actions |
event | Things that happened (order placed, ticket opened) |
error | Issues or failures to avoid repeating |
Persisting Session Tokens
Sessions expire after 6 hours. For long-running or scheduled workflows, extend the session: Extend Session (HTTP Request)| Field | Value |
|---|---|
| Method | POST |
| URL | http://your-memanto-server:8000/api/v2/session/extend |
| Query Parameters | extend_hours: 6 |
| Headers | Both Authorization and X-Session-Token |