n8n and Zapier
Put a person's approval in the middle of an n8n or Zapier workflow with plain HTTP steps.
A workflow tool can ask for approval with two plain HTTP steps: one that creates the request, one that reads the answer. Put them before the step that sends, pays or deletes, and let the workflow continue only on a yes.
n8n
- Create a credential of type Header Auth: name
Authorization, valueBearer gl_YOUR_KEY. - Add an HTTP Request node named Ask: method POST, URL
https://api.variantgate.com/v1/requests, that credential, and a JSON body:
{
"agent": "n8n-invoices",
"action": "invoice.send",
"summary": "Send invoice {{ $json.number }} for €{{ $json.total }} to {{ $json.email }}",
"amount": "{{ $json.total }}",
"currency": "EUR",
"wait_seconds": 30
}- Add an HTTP Request node named Check: method GET, URL
https://api.variantgate.com/v1/requests/{{ $json.id }}?wait_seconds=30, the same credential. - Add an If node after Check: when
{{ $json.status }}equalspending, connect the true branch back to Check. - On the false branch add another If node: continue to the real action only when
{{ $json.allowed }}is true.
Each Check holds the call open for up to 30 seconds, so the loop runs about twice a minute until someone decides or the request expires.
Zapier
A Zap cannot loop, so it asks, waits a fixed time, then reads the answer once.
- Webhooks by Zapier, POST: URL
https://api.variantgate.com/v1/requests, payload type JSON, dataagent,action,summaryandttl_seconds900, and a headerAuthorizationwithBearer gl_YOUR_KEY. - Delay by Zapier: Delay For 15 minutes.
- Webhooks by Zapier, GET: URL
https://api.variantgate.com/v1/requests/followed by the id from step 1, with the same header. - Filter by Zapier: only continue if
allowed(Boolean) is true.
Make the delay as long as the time limit. A request nobody answered by then has expired, the filter stops the Zap, and a late approval can no longer start anything.
Without a waiting loop: webhooks
On Pro and up, VariantGate can call your workflow the moment a request is decided, instead of the workflow checking back. Split the flow in two: the first asks and ends; the second starts when the answer arrives.
- Start the second flow with a trigger that receives a POST: a Webhook node in n8n, or Catch Hook in Webhooks by Zapier. Copy its URL, which must be a public
httpsaddress. - In VariantGate, under Settings, Webhooks, add that URL and choose the events
request.approved,request.deniedandrequest.expired. - After the trigger, read the answer with the agent key: GET
https://api.variantgate.com/v1/requests/followed bydata.request_idfrom the event, and continue only whenallowedis true.
The event tells the flow to look; the GET says whether it may act, and it also covers a pause that came after the decision, so a forged event cannot start anything. An approval stays approved, though, and an event can arrive more than once: keep the request ids the flow has acted on and stop on one it has seen, or pass the request id to the action as its idempotency key. Where your tool can run code, also check the signature as the webhooks page shows.
What to send
- agent
- The workflow's name, the same every run.
- action
- What it wants to do, such as invoice.send. Rules match on it.
- summary
- One sentence with the facts a person needs: amount, recipient, count.
- amount, currency
- Optional. Lets rules with amount limits and budgets decide.
- Use one key per workflow, so each can be paused on its own from the emergency stop.
- The full list of fields is on the Requests page.