feat(skill): add n8n action-bus helper

This commit is contained in:
zap
2026-03-12 06:51:15 +00:00
parent 7a44225481
commit 295809b161
4 changed files with 225 additions and 42 deletions

View File

@@ -25,52 +25,88 @@ Recommended success response:
}
```
## Recommended contract for new endpoints
## Preferred router endpoint
Prefer a stable JSON shape like:
### `openclaw-action`
Purpose:
- keep the external n8n surface small
- route several agent-safe operations behind one authenticated webhook
Recommended request shape:
```json
{
"action": "append_log",
"args": {
"text": "backup complete"
},
"request_id": "optional-uuid"
}
```
Recommended success response:
```json
{
"ok": true,
"request_id": "optional-uuid",
"result": {
"...": "workflow-specific payload"
"status": "accepted"
}
}
```
On failure, return a non-2xx status plus:
Recommended failure response:
```json
{
"ok": false,
"error": {
"code": "short-machine-code",
"message": "human-readable summary"
"code": "unknown_action",
"message": "action is not supported"
}
}
```
## Naming guidance
## Suggested initial actions
- Use lowercase kebab-case webhook paths.
- Keep names explicit: `openclaw-ping`, `openclaw-action`, `append-log`, `send-notify`.
- Avoid generic names like `run`, `task`, or `webhook1`.
### `append_log`
## Suggested action-bus pattern
If multiple agent-safe actions are needed, prefer one router webhook such as `openclaw-action`.
Request shape:
Request:
```json
{
"action": "append_log",
"args": {
"text": "backup finished"
},
"request_id": "optional-uuid"
"text": "backup complete"
}
}
```
That keeps the external surface small while letting n8n route internally.
Purpose:
- append a short line to a known log or tracking sink
### `notify`
Request:
```json
{
"action": "notify",
"args": {
"message": "workflow finished",
"title": "optional title"
}
}
```
Purpose:
- send a small notification through a known downstream channel
## Naming guidance
- Use lowercase kebab-case for webhook paths.
- Use lowercase snake_case or kebab-case consistently for action names; prefer snake_case for JSON actions if using switch/router logic.
- Keep names explicit: `openclaw-ping`, `openclaw-action`, `append_log`, `notify`.
- Avoid generic names like `run`, `task`, or `webhook1`.