Loading…
TL;DR: When an invoice or expense arrives (email or upload), this playbook extracts the key fields, validates them against rules and budgets, then parks with metaphor.waitForInput for human approval when needed. On Continue / Slack reply it creates the bill. Trigger is a webhook or inbox; outputs are a structured record and a durable approval gate.
Finance and ops teams processing invoices and expenses by hand.
Build a playbook that triggers when a new invoice arrives via webhook with a PDF link.
Extract vendor, invoice number, line items, amount, currency, and due date. Validate:
amount under the auto-approve threshold, vendor exists in our AP system, and no
duplicate invoice number. If valid and under threshold, create the bill in the AP system
and notify #finance. If over threshold or failing a check, call metaphor.waitForInput
with prompt, details (extracted fields + PDF link), and Approve/Reject choices — do not
busy-wait or poll Slack. After wake: on approve create the bill; on reject stop and notify.
Optionally post a Slack message from a notifier that wakes via POST /api/runs/:id/reply.
await metaphor.waitForInput({ prompt, details, schema }) so the run parks as Paused on the same runId.POST /reply returns the choice; approve creates the bill, reject aborts.details on waitForInput so reviewers see the payload in Studio.requestId from state.resume, not a custom pause API. See pause and resume.