⚡ Run a self-hosted multi-channel AI assistant with Claude, Gemini and Gmail

645 views · ⚡ Personal Productivity

Description

n8nClaw — Self-Hosted AI Assistant

A lightweight, self-hosted AI assistant built entirely in n8n. Multi-channel messaging (Telegram, WhatsApp, Gmail), persistent memory, task management, and autonomous work — all in a single visual workflow.

Inspired by OpenClaw.

What It Does

n8nClaw is a personal AI assistant that lives inside n8n. It connects to your messaging apps, remembers past conversations, manages tasks, and can work autonomously on your behalf.

Core capabilities:

How It Works

1. Triggers & Input Processing

Four triggers feed into the agent:

Each trigger filters messages (e.g., by Telegram chat ID or phone number), fetches the user profile from an Init data table, and normalizes the input into a standard format (user_message, system_prompt, last_channel).

2. Core AI Agent (n8nClaw)

The central agent uses Claude Sonnet 4.5 (via OpenRouter) with a 15-message Postgres chat memory window. It receives the normalized input and decides how to respond — using tools, delegating to sub-agents, or replying directly.

3. Tools

The agent has direct access to:

4. Sub-Agents

Specialized agents handle domain-specific work:

AgentModelPurpose
Research AgentGemini 3 FlashWeb research via Tavily + Wikipedia
Email ManagerClaude Haiku 4.5Gmail operations (read, reply, send, delete, search)
Document ManagerClaude Haiku 4.5Google Docs/Drive operations
Worker 1Claude Haiku 4.5Simple tasks
Worker 2Claude Sonnet 4.5Mid-level work
Worker 3Claude Opus 4.6Complex reasoning

5. Output Routing

A Switch node routes the agent’s response back to the originating channel (Telegram or WhatsApp).

6. Long-Term Memory Pipeline

A separate scheduled flow runs periodically to:

  1. Pull new chat history from Postgres
  2. Aggregate and summarize conversations (Haiku 4.5)
  3. Generate embeddings (OpenAI)
  4. Store in Supabase vector database for future RAG retrieval

Setup Steps

Step 1: Import the Workflow

  1. Open n8n
  2. Go to Workflows → Import from File
  3. Select the n8nClaw.json file

Step 2: Create Data Tables

Create three n8n data tables:

Init Table (user profile):

ColumnType
usernamestring
soulstring
userstring
heartbeatstring
last_channelstring
last_vector_idnumber

Tasks Table:

ColumnType
task_namestring
task_detailsstring
task_completeboolean
Is_recurringboolean

Subtasks Table:

ColumnType
parent_task_idstring
subtask_namestring
subtask_detailsstring
subtask_completeboolean

Step 3: Set Up Supabase Vector Store

Create a documents table in Supabase with the pgvector extension enabled. The table should match the schema expected by n8n’s Supabase Vector Store node (include a match_documents function).

Step 4: Configure Credentials

Set up the following credentials in n8n (only configure the channels and services you plan to use):

CredentialRequired For
Telegram Bot APITelegram channel
OpenRouter APIAll AI models
PostgresChat memory
SupabaseVector store / RAG
OpenAI APIEmbeddings
Gmail OAuth2Email management
Evolution APIWhatsApp
Google AI (Gemini)Media processing
Google Docs/Drive OAuth2Document management
Tavily APIWeb search (Research Agent)

Step 5: Update Placeholders

Search the workflow for YOUR_ and replace with your actual values:

PlaceholderReplace With
YOUR_USERNAMEYour chosen username
YOUR_TELEGRAM_CHAT_IDYour Telegram chat ID
YOUR_PHONEYour phone number (WhatsApp)
YOUR_EVOLUTION_INSTANCEYour Evolution API instance name
YOUR_*_TABLE_IDIDs of the data tables from Step 2
YOUR_*_CREDENTIAL_IDAuto-populated when connecting credentials
YOUR_PROJECT_IDYour n8n project ID

Step 6: Activate

  1. Connect all credentials in the n8n UI
  2. Point data table nodes to your tables
  3. Update filter nodes with your Telegram chat ID / WhatsApp number
  4. Activate the workflow

🔗 Nodes Used

Postgres, Webhook, Telegram, Telegram Trigger, Gmail Trigger, Schedule Trigger

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup