Combining OpenClaw with n8n for powerful personal automations
How to connect your OpenClaw personal AI agent with n8n's automation workflows. Trigger AI responses from emails, forms, and webhooks, and use your agent as a building block in larger automations.
Two complementary tools
OpenClaw and n8n solve different problems but work well together. OpenClaw gives you a conversational AI agent in your messaging apps — something you interact with directly, that knows your context, and that responds intelligently. n8n is a workflow automation platform (open-source, self-hostable) that connects apps, triggers actions, and processes data without requiring code for most workflows.
On their own: OpenClaw handles AI conversation. n8n handles system-to-system automation. Combined: you get AI-powered automations that can read your email, process form submissions, respond to webhooks, and take intelligent action — all triggered automatically.
The integration architecture
There are two ways to connect OpenClaw and n8n:
- n8n calls OpenClaw's API — n8n triggers an AI inference request through OpenClaw when certain events happen (new email, form submission, scheduled time). OpenClaw processes the AI response and n8n uses the result in subsequent workflow steps.
- OpenClaw webhooks trigger n8n — When your agent receives a specific command or message, it sends a webhook to n8n, which then executes a workflow (create a calendar event, update a spreadsheet, send an SMS).
You can run n8n on the same VPS as OpenClaw (it needs roughly 1 GB additional RAM) or on a separate server if you want clean separation.
Installing n8n on your VPS
n8n runs as a Node.js application. On your VPS (assuming Node.js 22 is already installed by the k-claw installer):
npm install -g n8n
n8n start
For production use, run it as a systemd service on port 5678 with a reverse proxy (nginx) in front. Enable HTTPS with Let's Encrypt so webhooks from external services (Gmail, GitHub, etc.) can reach it securely.
Workflow 1: AI-processed email digest
This workflow runs every morning at 7am, fetches your Gmail inbox, sends the subjects and senders to OpenClaw's API for prioritization, and delivers a Telegram message with your AI-sorted digest.
n8n workflow steps:
- Cron trigger: 7:00 AM every weekday
- Gmail node: Fetch emails from the last 12 hours
- HTTP Request node: POST email data to OpenClaw API (
POST /api/agent/query) - Telegram node: Send the AI-formatted summary to your chat
OpenClaw's response to the query contains the prioritized summary, which n8n extracts and forwards to Telegram.
Workflow 2: form submission AI responder
For freelancers or small businesses, this workflow processes contact form submissions with AI before they reach your inbox. When someone fills out your contact form:
- Webhook trigger: Receives the form data
- OpenClaw API call: "Given this inquiry, is this a genuine prospect or spam? If genuine, categorize it and suggest a response."
- IF node: Route based on AI classification
- Genuine prospect: Send to your CRM + notify you via Telegram with AI summary + suggested response
- Spam: Log and discard silently
Workflow 3: meeting notes to action items
After a meeting, paste or upload your notes to a specific Telegram command. OpenClaw processes them and sends a structured summary to n8n via webhook, which then:
- Creates tasks in your project management tool (Todoist, Linear, Notion)
- Sends a summary email to all participants via Gmail
- Creates calendar events for follow-up dates mentioned in the notes
OpenClaw API endpoint reference
For n8n HTTP Request nodes, OpenClaw exposes a simple REST API on your server:
POST http://localhost:3001/api/agent/query
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
{
"message": "Summarize these emails and rank by urgency: ...",
"context": "optional additional context",
"stream": false
}
The response contains the AI-generated text that n8n can then route, transform, or forward.
Security considerations
When n8n and OpenClaw communicate on the same server, use localhost addresses rather than exposing the OpenClaw API publicly. If they're on separate servers, use API token authentication and restrict the OpenClaw API to your n8n server's IP via UFW firewall rules.
Never expose OpenClaw's API on a public port without authentication — it provides direct access to your AI agent and its memory.
Getting started
The best first project is the email digest — it requires no custom code, delivers immediate value, and teaches you the pattern of calling OpenClaw from an n8n HTTP node. Once that's working, the other workflows follow naturally.
k-claw's advanced course covers the n8n integration in detail, including authentication setup and example workflow JSON files you can import directly.
Automate your workflows. From your phone.
OpenClaw connects to 5,400+ skills. Build automations that run 24/7 without you — all managed from Telegram or WhatsApp.
Start automatingRelated articles
What is a personal AI agent? A complete guide for 2026
Learn what personal AI agents are, how they work, and why self-hosting gives you privacy, control, and unlimited customization compared to cloud-based assistants.
How to install OpenClaw on a VPS: step-by-step guide
A complete walkthrough for installing OpenClaw on your own VPS. From choosing a server to configuring AI models and messaging channels.