n8n-nodes-clawai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +269 -0
- package/dist/credentials/OpenClawApi.credentials.js +55 -0
- package/dist/nodes/OpenClaw/OpenClaw.node.js +767 -0
- package/dist/nodes/OpenClaw/openclaw.svg +19 -0
- package/dist/nodes/OpenClawTrigger/OpenClawTrigger.node.js +143 -0
- package/dist/nodes/OpenClawTrigger/openclaw.svg +19 -0
- package/dist/nodes/shared/GenericFunctions.js +114 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ariel Tolome
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# n8n-nodes-clawai
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/n8n-nodes-clawai)
|
|
4
|
+
[](https://github.com/ArielleTolome/n8n-nodes-clawai/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Community n8n nodes for [OpenClaw](https://github.com/openclaw/openclaw) — a multi-agent AI gateway. Connect your n8n workflows to any OpenClaw instance to send messages, run agents, invoke tools, manage cron jobs, and receive real-time events.
|
|
8
|
+
|
|
9
|
+
## Contents
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Nodes](#nodes)
|
|
13
|
+
- [OpenClaw (Action Node)](#openclaw-action-node)
|
|
14
|
+
- [OpenClaw Trigger](#openclaw-trigger-webhook-node)
|
|
15
|
+
- [Credentials](#credentials)
|
|
16
|
+
- [Usage Examples](#usage-examples)
|
|
17
|
+
- [OpenClaw API Reference](#openclaw-api-reference)
|
|
18
|
+
- [Development](#development)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
### Via n8n Community Nodes (recommended)
|
|
25
|
+
|
|
26
|
+
1. In n8n, go to **Settings → Community Nodes**
|
|
27
|
+
2. Click **Install a community node**
|
|
28
|
+
3. Enter `n8n-nodes-clawai`
|
|
29
|
+
4. Click **Install**
|
|
30
|
+
|
|
31
|
+
### Manual (npm)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install n8n-nodes-clawai
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> **Publishing:** Run `npm publish` manually after authenticating with npm. The package is available on [npmjs.com](https://www.npmjs.com/package/n8n-nodes-clawai).
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Nodes
|
|
42
|
+
|
|
43
|
+
### OpenClaw (Action Node)
|
|
44
|
+
|
|
45
|
+
Interact with your OpenClaw gateway. Supports six resources:
|
|
46
|
+
|
|
47
|
+
| Resource | Operations |
|
|
48
|
+
|----------|-----------|
|
|
49
|
+
| **Agent** | Wake, Run Agent |
|
|
50
|
+
| **Chat Completion** | Complete (OpenAI-compatible) |
|
|
51
|
+
| **Cron** | List, Add, Update, Remove, Run |
|
|
52
|
+
| **Memory** | Search, Store |
|
|
53
|
+
| **Session** | List, Send Message, Get History, Spawn |
|
|
54
|
+
| **Tool** | Invoke (10 preset tools + custom) |
|
|
55
|
+
|
|
56
|
+
> The node is marked `usableAsTool: true` — it can be used directly as a tool inside an n8n AI Agent node.
|
|
57
|
+
|
|
58
|
+
### OpenClaw Trigger (Webhook Node)
|
|
59
|
+
|
|
60
|
+
Receives events from OpenClaw. Exposes a webhook URL you paste into your OpenClaw gateway config.
|
|
61
|
+
|
|
62
|
+
| Event Type | Description |
|
|
63
|
+
|-----------|-------------|
|
|
64
|
+
| Any Event | All POST payloads |
|
|
65
|
+
| Agent Completion | When an agent finishes a task |
|
|
66
|
+
| Wake Event | When a wake/system event fires |
|
|
67
|
+
|
|
68
|
+
**Security features:**
|
|
69
|
+
- Optional webhook token verification (checks `Authorization: Bearer <token>`)
|
|
70
|
+
- Optional raw header passthrough for custom validation
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Credentials
|
|
75
|
+
|
|
76
|
+
Create an **OpenClaw API** credential:
|
|
77
|
+
|
|
78
|
+
| Field | Description | Default |
|
|
79
|
+
|-------|-------------|---------|
|
|
80
|
+
| Gateway URL | URL of your OpenClaw gateway | `http://localhost:18789` |
|
|
81
|
+
| Token | Bearer token for authentication | — |
|
|
82
|
+
|
|
83
|
+
The token comes from your OpenClaw config (`hooks.token` or your gateway auth config).
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
### 1. Wake the main agent with a message
|
|
90
|
+
|
|
91
|
+
**Workflow:** HTTP Request → OpenClaw
|
|
92
|
+
|
|
93
|
+
**Node settings:**
|
|
94
|
+
- Resource: `Agent`
|
|
95
|
+
- Operation: `Wake`
|
|
96
|
+
- Message: `{{ $json.body.text }}`
|
|
97
|
+
- Session Key: `main`
|
|
98
|
+
|
|
99
|
+
This is useful for triggering the main OpenClaw session from an external event (e.g. a form submission, Slack message, etc.).
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 2. Run an isolated agent turn
|
|
104
|
+
|
|
105
|
+
**Node settings:**
|
|
106
|
+
- Resource: `Agent`
|
|
107
|
+
- Operation: `Run Agent`
|
|
108
|
+
- Prompt: `Summarize the following and return JSON: {{ $json.content }}`
|
|
109
|
+
- System Prompt: `You are a JSON extraction expert. Return only valid JSON.`
|
|
110
|
+
- Model: `anthropic/claude-sonnet-4-5` _(leave empty for gateway default)_
|
|
111
|
+
|
|
112
|
+
The agent runs in isolation — it doesn't affect main session history.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 3. Send a message to a Discord channel via OpenClaw
|
|
117
|
+
|
|
118
|
+
**Node settings:**
|
|
119
|
+
- Resource: `Tool`
|
|
120
|
+
- Operation: `Invoke`
|
|
121
|
+
- Tool: `message`
|
|
122
|
+
- Action: `send`
|
|
123
|
+
- Arguments:
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"target": "my-channel",
|
|
127
|
+
"message": "Alert: {{ $json.alert_text }}"
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### 4. Add a daily cron job
|
|
134
|
+
|
|
135
|
+
**Node settings:**
|
|
136
|
+
- Resource: `Cron`
|
|
137
|
+
- Operation: `Add`
|
|
138
|
+
- Cron Name: `daily-report`
|
|
139
|
+
- Schedule: `0 9 * * *`
|
|
140
|
+
- Task: `Generate and send a daily summary report to #reports`
|
|
141
|
+
- Session Key: `main`
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### 5. Spawn a sub-agent and get its session key
|
|
146
|
+
|
|
147
|
+
**Node settings:**
|
|
148
|
+
- Resource: `Session`
|
|
149
|
+
- Operation: `Spawn`
|
|
150
|
+
- Task: `Research the top 3 AI news stories this week and return as JSON array`
|
|
151
|
+
- Label: `news-researcher`
|
|
152
|
+
|
|
153
|
+
The response contains the spawned session's key, which you can use to poll for completion.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### 6. Get session history
|
|
158
|
+
|
|
159
|
+
**Node settings:**
|
|
160
|
+
- Resource: `Session`
|
|
161
|
+
- Operation: `Get History`
|
|
162
|
+
- Session Key: `main`
|
|
163
|
+
- Limit: `50`
|
|
164
|
+
|
|
165
|
+
Returns the last N messages from the specified session.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### 7. Receive an agent completion event (trigger)
|
|
170
|
+
|
|
171
|
+
1. Add an **OpenClaw Trigger** node
|
|
172
|
+
2. Set Event Type: `Agent Completion`
|
|
173
|
+
3. Activate the workflow — copy the displayed webhook URL
|
|
174
|
+
4. In your OpenClaw gateway config:
|
|
175
|
+
```yaml
|
|
176
|
+
hooks:
|
|
177
|
+
enabled: true
|
|
178
|
+
token: your-secret-token
|
|
179
|
+
delivery:
|
|
180
|
+
to: https://your-n8n-instance/webhook/openclaw
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
When an agent finishes, the payload is delivered to n8n and your downstream nodes run.
|
|
184
|
+
|
|
185
|
+
**Trigger output data:**
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"type": "agentCompletion",
|
|
189
|
+
"sessionKey": "subagent:...",
|
|
190
|
+
"result": "...",
|
|
191
|
+
"completedAt": "2026-03-29T12:00:00.000Z",
|
|
192
|
+
"_receivedAt": "2026-03-29T12:00:01.234Z"
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 8. Search the web via OpenClaw
|
|
199
|
+
|
|
200
|
+
**Node settings:**
|
|
201
|
+
- Resource: `Tool`
|
|
202
|
+
- Operation: `Invoke`
|
|
203
|
+
- Tool: `web_search`
|
|
204
|
+
- Action: `json`
|
|
205
|
+
- Arguments:
|
|
206
|
+
```json
|
|
207
|
+
{ "query": "{{ $json.search_term }}" }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## OpenClaw API Reference
|
|
213
|
+
|
|
214
|
+
| Endpoint | Method | Description |
|
|
215
|
+
|----------|--------|-------------|
|
|
216
|
+
| `/hooks/wake` | POST | Wake main session with system event |
|
|
217
|
+
| `/hooks/agent` | POST | Run an isolated agent turn |
|
|
218
|
+
| `/tools/invoke` | POST | Invoke any registered OpenClaw tool |
|
|
219
|
+
| `/v1/chat/completions` | POST | OpenAI-compatible completions |
|
|
220
|
+
|
|
221
|
+
### `/tools/invoke` body schema
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"tool": "string",
|
|
226
|
+
"action": "string",
|
|
227
|
+
"args": {},
|
|
228
|
+
"sessionKey": "main",
|
|
229
|
+
"dryRun": false
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Available tools (preset list)
|
|
234
|
+
|
|
235
|
+
| Tool | Common actions |
|
|
236
|
+
|------|---------------|
|
|
237
|
+
| `message` | `send` |
|
|
238
|
+
| `cron` | `list`, `add`, `update`, `remove`, `run` |
|
|
239
|
+
| `sessions_list` | `json` |
|
|
240
|
+
| `sessions_send` | `json` |
|
|
241
|
+
| `sessions_history` | `json` |
|
|
242
|
+
| `sessions_spawn` | `json` |
|
|
243
|
+
| `memory_store` | `json` |
|
|
244
|
+
| `memory_search` | `json` |
|
|
245
|
+
| `web_search` | `json` |
|
|
246
|
+
| `web_fetch` | `json` |
|
|
247
|
+
|
|
248
|
+
Use the `Custom` option in the Tool dropdown for any other registered tool.
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Development
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
git clone https://github.com/ArielleTolome/n8n-nodes-clawai.git
|
|
256
|
+
cd n8n-nodes-openclaw
|
|
257
|
+
npm install
|
|
258
|
+
npm run build # compile TypeScript
|
|
259
|
+
npm run lint # ESLint check
|
|
260
|
+
npm test # run 34 unit tests
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development guide.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## License
|
|
268
|
+
|
|
269
|
+
MIT — see [LICENSE](LICENSE)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenClawApi = void 0;
|
|
4
|
+
class OpenClawApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'openClawApi';
|
|
7
|
+
this.displayName = 'OpenClaw API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/ArielleTolome/n8n-nodes-openclaw';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Gateway URL',
|
|
12
|
+
name: 'gatewayUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: 'http://localhost:18789',
|
|
15
|
+
placeholder: 'http://localhost:18789',
|
|
16
|
+
description: 'The URL of your OpenClaw gateway (e.g. http://localhost:18789)',
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Token',
|
|
21
|
+
name: 'token',
|
|
22
|
+
type: 'string',
|
|
23
|
+
typeOptions: {
|
|
24
|
+
password: true,
|
|
25
|
+
},
|
|
26
|
+
default: '',
|
|
27
|
+
description: 'The Bearer token for OpenClaw gateway authentication',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
this.authenticate = {
|
|
32
|
+
type: 'generic',
|
|
33
|
+
properties: {
|
|
34
|
+
headers: {
|
|
35
|
+
Authorization: '=Bearer {{$credentials.token}}',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
this.test = {
|
|
40
|
+
request: {
|
|
41
|
+
baseURL: '={{$credentials.gatewayUrl}}',
|
|
42
|
+
url: '/tools/invoke',
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body: {
|
|
45
|
+
tool: 'sessions_list',
|
|
46
|
+
action: 'json',
|
|
47
|
+
args: {},
|
|
48
|
+
sessionKey: 'main',
|
|
49
|
+
dryRun: false,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.OpenClawApi = OpenClawApi;
|