4.0 KiB
4.0 KiB
openclaw-action workflow
This skill ships an importable workflow at:
assets/openclaw-action.workflow.json
It implements a real local OpenClaw → n8n router.
What it does
- accepts
POST /webhook/openclaw-action - normalizes incoming JSON into an action contract
- supports three live actions:
append_logget_logsnotify
- returns normalized JSON responses
- returns
400for unknown actions - returns
400when required args are missing
Current side effects
append_log
- appends records into workflow static data under key:
actionLog
- keeps the most recent
200entries - persists in n8n's database when the workflow execution succeeds
Example stored record:
{"ts":"2026-03-12T07:00:00Z","source":"openclaw-action","request_id":"abc","text":"backup complete"}
get_logs
- reads from workflow static data key:
actionLog
- returns newest-first
- default
limitis20 - clamps
limitto1..50
notify
- sends a Telegram message using credential:
Telegram Bot (OpenClaw)
- sends a Discord message using credential:
Discord Bot Auth
- current targets mirror the already-working reminder workflow
Why workflow static data for logs
Why this first:
- built-in, no extra credentials
- persists without guessing writable filesystem paths
- better fit than MinIO for small, recent operational breadcrumbs
When to use MinIO later:
- long retention
- rotated archives
- large/batched exports
- sharing logs outside n8n
Intentional security choice
The exported workflow leaves the Webhook node auth unset in the JSON file.
Why:
- n8n credentials are instance-local
- secrets should not be embedded in a shareable skill asset
After import, set this manually in n8n:
- Webhook node → Authentication →
Header Auth - bind a credential with:
- header name:
x-openclaw-secret - header value: your generated shared secret
- header name:
Import steps
- In n8n, create or open a workflow.
- Import
assets/openclaw-action.workflow.json. - Open the Webhook node.
- Set Authentication to
Header Auth. - Bind your local credential.
- Save.
- Use Listen for test event and call the test URL first.
- Once successful, activate the workflow for production URL use.
Expected URLs
- test:
http://192.168.153.113:18808/webhook-test/openclaw-action - prod:
http://192.168.153.113:18808/webhook/openclaw-action
Test payloads included
assets/test-append-log.jsonassets/test-notify.json
Example tests
export N8N_WEBHOOK_SECRET='YOUR_SECRET_HERE'
scripts/call-action.sh append_log --args '{"text":"backup complete"}' --pretty
scripts/call-action.sh get_logs --args '{"limit":5}' --pretty
scripts/call-action.sh notify --args '{"title":"Workflow finished","message":"n8n router test"}' --pretty
Expected success examples
append_log
{
"ok": true,
"request_id": "test-append-log-001",
"result": {
"action": "append_log",
"status": "logged",
"preview": {
"text": "backup complete"
},
"sink": {
"type": "workflow-static-data",
"key": "actionLog",
"retained_entries": 200
}
}
}
get_logs
{
"ok": true,
"request_id": "",
"result": {
"action": "get_logs",
"status": "ok",
"count": 1,
"total_retained": 1,
"retained_entries": 200,
"entries": [
{
"ts": "2026-03-12T08:42:37.615Z",
"source": "openclaw-action",
"request_id": "live-log-003",
"text": "n8n append_log static-data verification"
}
]
}
}
notify
{
"ok": true,
"request_id": "test-notify-001",
"result": {
"action": "notify",
"status": "sent",
"preview": {
"title": "Workflow finished",
"message": "n8n router test"
},
"targets": ["telegram", "discord"]
}
}
Validation
Run the local validator before import/package changes:
python3 scripts/validate-workflow.py assets/openclaw-action.workflow.json