Files
swarm-zap/skills/n8n-webhook/references/openclaw-action.md
T
2026-03-12 16:45:19 +00:00

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_log
    • get_logs
    • notify
  • returns normalized JSON responses
  • returns 400 for unknown actions
  • returns 400 when required args are missing

Current side effects

append_log

  • appends records into workflow static data under key:
    • actionLog
  • keeps the most recent 200 entries
  • 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 limit is 20
  • clamps limit to 1..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 → AuthenticationHeader Auth
  • bind a credential with:
    • header name: x-openclaw-secret
    • header value: your generated shared secret

Import steps

  1. In n8n, create or open a workflow.
  2. Import assets/openclaw-action.workflow.json.
  3. Open the Webhook node.
  4. Set Authentication to Header Auth.
  5. Bind your local credential.
  6. Save.
  7. Use Listen for test event and call the test URL first.
  8. 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.json
  • assets/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