feat(n8n-webhook): add gmail draft list/delete/send approval flows

This commit is contained in:
zap
2026-03-12 20:58:02 +00:00
parent e45949d496
commit 111dda91b8
10 changed files with 321 additions and 17 deletions

View File

@@ -34,6 +34,12 @@ Keep the integration narrow: let OpenClaw decide what to do, and let n8n execute
- `assets/test-append-log.json`
- `assets/test-notify.json`
- `assets/test-send-notification-draft.json`
- `assets/test-send-email-draft.json`
- `assets/test-list-email-drafts.json`
- `assets/test-delete-email-draft.json`
- `assets/test-send-gmail-draft.json`
- `assets/test-send-approved-email.json`
- `assets/test-create-calendar-event.json`
## Quick usage
@@ -54,6 +60,7 @@ Call the preferred action-bus route:
```bash
scripts/call-action.sh append_log --args '{"text":"backup complete"}' --request-id auto
scripts/call-action.sh get_logs --args '{"limit":5}' --pretty
scripts/call-action.sh list_email_drafts --args '{"max":10}' --pretty
```
Call a test webhook while editing a flow:
@@ -104,7 +111,10 @@ Use the included workflow asset when you want a ready-made local router for:
- `get_logs` → read the most recent retained records from `actionLog`
- `notify` → send through the current Telegram + Discord notification paths
- `send_notification_draft` → queue approval-gated notifications that execute on approve through Telegram + Discord
- `send_email_draft` → queue approval-gated email drafts in workflow static data
- `send_email_draft` → queue approval-gated email draft creation proposals in workflow static data
- `list_email_drafts` → queue approval-gated Gmail draft list requests (read-only, low mutation level)
- `delete_email_draft` → queue approval-gated Gmail draft deletion requests
- `send_gmail_draft` (alias: `send_approved_email`) → queue approval-gated Gmail draft send requests
- `create_calendar_event` → queue approval-gated calendar proposals in workflow static data
- `approval_queue_add` / `approval_queue_list` / `approval_queue_resolve` → manage pending approvals and recent history
- `approval_history_attach_execution` → let a host-side executor attach real execution metadata back onto approval history entries
@@ -128,6 +138,13 @@ When email/calendar provider creds live on the host via `gog` rather than inside
python3 scripts/resolve-approval-with-gog.py --id <approval-id> --decision approve
```
Supported host-executed approval kinds:
- `email_draft``gog gmail drafts create`
- `email_list_drafts``gog gmail drafts list`
- `email_draft_delete``gog gmail drafts delete`
- `email_draft_send``gog gmail drafts send`
- `calendar_event``gog calendar create`
Practical note:
- unattended execution needs `GOG_KEYRING_PASSWORD` available to the executor because `gog`'s file keyring cannot prompt in non-TTY automation
- the included bridge auto-loads `/home/openclaw/.openclaw/credentials/gog.env` when present, so you can keep `GOG_ACCOUNT` and `GOG_KEYRING_PASSWORD` there with mode `600`