feat(n8n-webhook): add gmail draft list/delete/send approval flows
This commit is contained in:
@@ -16,6 +16,9 @@ It implements a real local OpenClaw → n8n router.
|
||||
- `notify`
|
||||
- `send_notification_draft`
|
||||
- `send_email_draft`
|
||||
- `list_email_drafts`
|
||||
- `delete_email_draft`
|
||||
- `send_gmail_draft` (alias: `send_approved_email`)
|
||||
- `create_calendar_event`
|
||||
- `approval_queue_add`
|
||||
- `approval_queue_list`
|
||||
@@ -49,13 +52,30 @@ Example stored record:
|
||||
- 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`
|
||||
### Gmail + Calendar approval-gated actions
|
||||
|
||||
- queue approval-gated proposals into workflow static data under key:
|
||||
Actions:
|
||||
- `send_email_draft`
|
||||
- `list_email_drafts`
|
||||
- `delete_email_draft`
|
||||
- `send_gmail_draft` (alias: `send_approved_email`)
|
||||
- `create_calendar_event`
|
||||
|
||||
Behavior:
|
||||
- queue proposals into workflow static data under key:
|
||||
- `approvalQueue`
|
||||
- keep the most recent `200` pending entries
|
||||
- do **not** send email or create provider-side calendar events in the shipped starter workflow
|
||||
- are designed to become safe provider-backed executors later once instance-local creds are bound in n8n
|
||||
- return explicit approval policy metadata per action (`approval.policy`, `approval.required`, `approval.mutation_level`)
|
||||
- do **not** execute Gmail/Calendar side effects directly in the shipped starter workflow
|
||||
- are intended for host-side execution via the included `gog` bridge after explicit approval resolution
|
||||
|
||||
Approval policy defaults:
|
||||
- `send_email_draft`, `delete_email_draft`, `send_gmail_draft` / `send_approved_email`, `create_calendar_event`
|
||||
- `approval.required = true`
|
||||
- `approval.mutation_level = "high"`
|
||||
- `list_email_drafts`
|
||||
- `approval.required = true`
|
||||
- `approval.mutation_level = "low"` (read-only action, still routed through approval queue for explicit operator acknowledgement + audit trail)
|
||||
|
||||
### `approval_queue_resolve`
|
||||
|
||||
@@ -147,6 +167,10 @@ After import, set this manually in n8n:
|
||||
- `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`
|
||||
- `assets/test-fetch-and-normalize-url.json`
|
||||
- `assets/test-approval-queue-list.json`
|
||||
@@ -161,6 +185,10 @@ 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 list_email_drafts --args-file assets/test-list-email-drafts.json --pretty
|
||||
scripts/call-action.sh delete_email_draft --args-file assets/test-delete-email-draft.json --pretty
|
||||
scripts/call-action.sh send_gmail_draft --args-file assets/test-send-gmail-draft.json --pretty
|
||||
scripts/call-action.sh send_approved_email --args-file assets/test-send-approved-email.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
|
||||
scripts/call-action.sh fetch_and_normalize_url --args '{"url":"https://example.com","skip_ssl_certificate_validation":true}' --pretty
|
||||
@@ -201,6 +229,57 @@ python3 scripts/resolve-approval-with-gog.py --id <approval-id> --decision appro
|
||||
}
|
||||
```
|
||||
|
||||
### list_email_drafts
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": true,
|
||||
"request_id": "test-list-email-drafts-001",
|
||||
"result": {
|
||||
"action": "list_email_drafts",
|
||||
"status": "queued_for_approval",
|
||||
"pending_id": "approval-ghi789",
|
||||
"approval_status": "pending",
|
||||
"approval": {
|
||||
"policy": "approval_queue_resolve",
|
||||
"required": true,
|
||||
"mutation_level": "low"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### delete_email_draft
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": true,
|
||||
"request_id": "test-delete-email-draft-001",
|
||||
"result": {
|
||||
"action": "delete_email_draft",
|
||||
"status": "queued_for_approval",
|
||||
"pending_id": "approval-jkl012",
|
||||
"approval_status": "pending"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### send_gmail_draft / send_approved_email
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": true,
|
||||
"request_id": "test-send-gmail-draft-001",
|
||||
"result": {
|
||||
"action": "send_gmail_draft",
|
||||
"requested_action": "send_gmail_draft",
|
||||
"status": "queued_for_approval",
|
||||
"pending_id": "approval-mno345",
|
||||
"approval_status": "pending"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### create_calendar_event
|
||||
|
||||
```json
|
||||
@@ -256,6 +335,9 @@ Behavior:
|
||||
- resolves an approval item through `openclaw-action`
|
||||
- executes supported kinds on the host:
|
||||
- `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`
|
||||
- writes execution metadata back via `approval_history_attach_execution`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user