master-zapier-plan-draft/packages/zapier-user-docs/05-wait-async-hooks.md
George Lambert f3dc0e6eee
Some checks are pending
offline / test (push) Waiting to run
Add Zapier interface simulator, tree-node Merkle lookups, and user docs
In-process trace console validates hops, faults, recoveries, and
suggested changes before zapier-platform push. User guide covers
signup through central-chain and bulk-summary tree-node hash lookup.
2026-09-11 12:58:03 -04:00

22 lines
1.1 KiB
Markdown

# 5. Wait, async, and completed hooks
Timestamping is not always instant. Middleware publishes `verae.zapier.jobs.watch`; a poller waits on the chain; then `verae.zapier.jobs.events` fires. Zapier never sees those subjects.
## Choose a pattern
| Pattern | Use when |
|---------|----------|
| **Wait** | The next Zap step needs the certificate now (Slack message, PDF receipt). |
| **Async + Find Job Status** | You stored `jobId` and will poll later. |
| **Timestamp Completed trigger** | You want a second Zap to run when the seal exists (REST Hook). |
If **Wait** returns `status: pending`, the chain or NATS event did not finish inside `WAIT_TIMEOUT_MS`. Pair async creates with the **Timestamp Completed** trigger instead of raising the timeout blindly.
## Trigger setup
1. New Zap → Verae Time → **Timestamp Completed**.
2. Zapier registers a REST Hook URL with middleware (`/zapier/v1/webhooks/subscribe`).
3. When `jobs.events` says `timestamp.completed`, middleware HTTPS POSTs that URL.
4. Turning the Zap off unsubscribes the hook.
The hook payload is the same completed-job JSON as wait (seal receipt, optional attached metadata).