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

  1. Create a credential of type Header Auth: name Authorization, value Bearer gl_YOUR_KEY.
  2. 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
}
  1. Add an HTTP Request node named Check: method GET, URL https://api.variantgate.com/v1/requests/{{ $json.id }}?wait_seconds=30, the same credential.
  2. Add an If node after Check: when {{ $json.status }} equals pending, connect the true branch back to Check.
  3. 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.

  1. Webhooks by Zapier, POST: URL https://api.variantgate.com/v1/requests, payload type JSON, data agent, action, summary and ttl_seconds 900, and a header Authorization with Bearer gl_YOUR_KEY.
  2. Delay by Zapier: Delay For 15 minutes.
  3. Webhooks by Zapier, GET: URL https://api.variantgate.com/v1/requests/ followed by the id from step 1, with the same header.
  4. 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.

  1. 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 https address.
  2. In VariantGate, under Settings, Webhooks, add that URL and choose the events request.approved, request.denied and request.expired.
  3. After the trigger, read the answer with the agent key: GET https://api.variantgate.com/v1/requests/ followed by data.request_id from the event, and continue only when allowed is 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.