This example simulates a backend service or AI deploy agent integrating with Approva.
It does four things:
- creates an approval request for
deployment.execute - exposes a signed webhook receiver for Approva terminal events
- exchanges the one-time capability delivery token when approval arrives
- calls
POST /v1/capabilities/usebefore simulatingdeployment executed
From the repo root:
cp examples/node-deploy-agent/.env.example examples/node-deploy-agent/.env
pnpm install
pnpm build:packages
pnpm --filter @approva-example/node-deploy-agent devDefault local settings:
- example app:
http://localhost:4100 - webhook receiver:
http://localhost:4100/webhooks/approva - Approva API base URL:
http://localhost:4000 - Approva API key:
APPROVA_API_KEY=approva_sk_...
GET /minimal operator page with current state and helper actionsGET /stateJSON state snapshotPOST /request-approvalcreates a new Approva approval requestPOST /webhooks/approvaverifiesX-Approval-SignatureandX-Approval-Timestamp
This example uses Approva's supported machine continuation flow:
- the approval request is created with
deliverCapabilityMode = exchange_token - the signed
approval_request.approvedwebhook includes:capabilityIdcapabilityExchangeTokencapabilityExchangeExpiresAt
- the agent exchanges that one-time token through
POST /v1/capabilities/exchange - Approva returns the raw opaque capability token once
- the agent calls
POST /v1/capabilities/use