feat(n8n-webhook): add approval-gated notification executor

This commit is contained in:
zap
2026-03-12 17:41:59 +00:00
parent dc990a1af3
commit 1eabaeb652
7 changed files with 65 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ It implements a real local OpenClaw → n8n router.
- `append_log`
- `get_logs`
- `notify`
- `send_notification_draft`
- `send_email_draft`
- `create_calendar_event`
- `approval_queue_add`
@@ -40,6 +41,13 @@ Example stored record:
{"ts":"2026-03-12T07:00:00Z","source":"openclaw-action","request_id":"abc","text":"backup complete"}
```
### `send_notification_draft`
- queues an approval-gated notification proposal into workflow static data under key:
- `approvalQueue`
- when resolved with `decision=approve`, it executes the existing `notify` path and sends through Telegram + Discord
- uses only the already-configured notification credentials in the live n8n instance
### `send_email_draft` and `create_calendar_event`
- queue approval-gated proposals into workflow static data under key:
@@ -129,6 +137,7 @@ After import, set this manually in n8n:
- `assets/test-append-log.json`
- `assets/test-notify.json`
- `assets/test-send-notification-draft.json`
- `assets/test-send-email-draft.json`
- `assets/test-create-calendar-event.json`
- `assets/test-fetch-and-normalize-url.json`
@@ -142,6 +151,7 @@ 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
scripts/call-action.sh send_notification_draft --args-file assets/test-send-notification-draft.json --pretty
scripts/call-action.sh send_email_draft --args-file assets/test-send-email-draft.json --pretty
scripts/call-action.sh create_calendar_event --args-file assets/test-create-calendar-event.json --pretty
scripts/call-action.sh fetch_and_normalize_url --args '{"url":"http://192.168.153.113:18808/healthz"}' --pretty
@@ -152,6 +162,21 @@ scripts/call-action.sh inbound_event_filter --args-file assets/test-inbound-even
## Expected success examples
### send_notification_draft
```json
{
"ok": true,
"request_id": "test-notify-draft-001",
"result": {
"action": "send_notification_draft",
"status": "queued_for_approval",
"pending_id": "approval-abc123",
"approval_status": "pending"
}
}
```
### send_email_draft
```json