If you're building anything beyond a basic chatbot with OpenClaw, you'll eventually need workflow automation. Maybe it's routing messages based on intent, syncing data between systems, or orchestrating multi-step processes that involve both AI and traditional business logic. That's where n8n comes in — and when you pair it with OpenClaw on the same infrastructure, things get interesting fast.
This guide covers the practical side: how to build custom n8n nodes for OpenClaw, design effective workflows, and avoid the common mistakes.
Both OpenClaw and n8n run beautifully on a single Tencent Cloud Lighthouse instance. The one-click OpenClaw deployment gets your agent running in minutes, and adding n8n via Docker is straightforward:
docker run -d \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
--restart unless-stopped \
n8nio/n8n
With both services on the same machine, inter-service calls happen over localhost — zero latency overhead. Grab an instance from the Tencent Cloud Lighthouse Special Offer to get started.
OpenClaw and n8n connect at three levels:
1. Webhook Triggers — OpenClaw fires webhooks when events occur (message received, skill invoked, error thrown). n8n listens and kicks off workflows.
2. API Calls — n8n workflows call OpenClaw's API to send messages, invoke skills, or update configuration.
3. Shared Data Stores — Both services can read/write to the same database or cache (Redis, PostgreSQL) for state sharing.
While the HTTP Request node handles basic API calls, a dedicated OpenClaw node makes workflows cleaner and more maintainable.
Every n8n custom node needs three things:
A description — metadata that tells n8n how to render the node in the editor:
description: INodeTypeDescription = {
displayName: 'OpenClaw Send Message',
name: 'openClawSendMessage',
group: ['output'],
version: 1,
description: 'Send a message through OpenClaw to a specific channel',
inputs: ['main'],
outputs: ['main'],
credentials: [{ name: 'openClawApi', required: true }],
properties: [
{
displayName: 'Channel',
name: 'channel',
type: 'options',
options: [
{ name: 'Telegram', value: 'telegram' },
{ name: 'Discord', value: 'discord' },
{ name: 'WhatsApp', value: 'whatsapp' },
],
default: 'telegram',
},
{
displayName: 'Recipient ID',
name: 'recipientId',
type: 'string',
default: '',
required: true,
},
{
displayName: 'Message',
name: 'message',
type: 'string',
default: '',
required: true,
},
],
};
An execute method — the actual logic:
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const creds = await this.getCredentials('openClawApi');
const channel = this.getNodeParameter('channel', 0) as string;
const recipientId = this.getNodeParameter('recipientId', 0) as string;
const message = this.getNodeParameter('message', 0) as string;
const response = await this.helpers.httpRequest({
method: 'POST',
url: `${creds.baseUrl}/api/messages/send`,
headers: { 'Authorization': `Bearer ${creds.apiKey}` },
body: { channel, recipientId, message },
});
return [this.helpers.returnJsonArray(response)];
}
A credentials class — for secure API key management (covered in the n8n integrated development article).
Here are battle-tested workflow patterns from the OpenClaw community.
Webhook (message received)
→ Code Node (extract intent from OpenClaw metadata)
→ Switch Node
→ "billing" → HTTP Request (billing API) → OpenClaw Send Message
→ "technical" → OpenClaw Skill Invoke (knowledge_base) → OpenClaw Send Message
→ "default" → OpenClaw Send Message (generic response)
Schedule Trigger (every Monday 9 AM)
→ HTTP Request (pull weekly metrics from analytics API)
→ Code Node (format into readable summary)
→ OpenClaw Send Message (post to #reports channel on Discord)
Webhook (new conversation on WhatsApp)
→ OpenClaw Skill Invoke (qualify_lead)
→ IF Node (lead score > threshold?)
→ Yes → HTTP Request (create CRM contact) → OpenClaw Send Message (schedule demo)
→ No → OpenClaw Send Message (send brochure)
The number one mistake in n8n workflows: no error handling. When an API call fails at 2 AM, you want the workflow to recover gracefully, not silently drop messages.
Use the Error Trigger node. It catches failures from any workflow and lets you route them — send an alert to Slack, log to a database, or retry with exponential backoff.
Set timeouts on every HTTP node. OpenClaw skills that call slow external APIs can hang. A 10-second timeout with a fallback response is better than an infinite wait.
Validate inputs in Code nodes. Don't trust that upstream data is always well-formed:
const orderId = $input.first().json.order_id;
if (!orderId || typeof orderId !== 'string') {
throw new Error('Missing or invalid order_id');
}
On a Lighthouse instance, you'll typically handle hundreds of workflow executions per minute without breaking a sweat. But keep these tips in mind:
Your workflows will likely interact with multiple messaging platforms. Here are the setup guides:
The combination of OpenClaw and n8n on Tencent Cloud Lighthouse gives you a complete automation platform — AI reasoning from OpenClaw, workflow orchestration from n8n, and reliable infrastructure from Lighthouse. All at a predictable monthly cost.
Build one workflow. Test it with real messages. Iterate. That's the whole playbook.