Flito docs

Webhooks

Fire an automation from your system, and call your system when something happens in Flito.

Receive: a webhook that runs an automation

Any system that can post JSON can run a Flito automation: a website form, a payment provider, a warehouse system, a script.

POST JSON to the webhook URLrun the automation with the posted fields200 ok, with the run idYour systemFlitoYour systemFlito
POST JSON to thewebhook URLrun the automationwith the postedfields200 ok, with therun idYour systemFlitoYour systemFlito

Get the URL

  1. In the app, open Automations and make an automation with the trigger Webhook received.
  2. In its Webhook panel, choose Generate webhook URL. The URL is shown once: copy it.
  3. Add the steps, using fields from the posted JSON as {{trigger.body.*}}. See Automations.
  4. Switch the automation on.

The URL looks like $FLITO_URL/hooks/whk_…. Anyone who has it can run the automation, so keep it on your server where you can; a form on a public page shows it to every visitor.

A new URL does not turn the old one off

Generating another URL adds a second one, and both work. If a URL leaks, pause the automation and make a new one with a new URL.

Call it

curl -s "$FLITO_URL/hooks/whk_…" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: order-1042" \
  -d '{"name": "Ada Lovelace", "email": "ada@acme.com", "company": "Acme", "message": "Please call me"}'
  • No API key: the URL itself is the secret.
  • Send X-Idempotency-Key to make retries safe. A key seen before answers 200 with "fired": false and "status": "skipped".
  • Browsers may call it: it answers cross-site requests from any page.
  • A body that is not JSON is read as {}.

Answers

  • 200 {"ok": true, "runId": "…", "status": "…", "fired": true}: the automation ran.
  • 200 with nothing run: the automation is paused.
  • 404 {"error": "unknown or disabled webhook"}: the URL is wrong or turned off.
  • 400 {"error": "…"}: the automation could not start.

Send: calling your system

Flito does not yet send a webhook for every change. Instead, an automation calls your system with an http.request step, so you choose what to send, when, and in what shape:

{
  "id": "notify",
  "type": "action",
  "capabilityId": "http.request",
  "input": {
    "method": "POST",
    "url": "https://api.yourcompany.com/flito/deal-won",
    "auth": { "kind": "bearer", "token": "…" },
    "body": { "dealId": "{{record.id}}", "name": "{{record.name}}", "amount": "{{record.amount}}" }
  }
}
  • method is GET, POST, PUT, PATCH or DELETE, with headers, query and body.
  • auth.kind is none, bearer (with token), basic (with username and password) or header (with headerName and token).
  • It waits up to timeoutMs (10 seconds by default, 30 at most) and reads up to maxBytes of the answer (1 MB by default, 5 MB at most).
  • Its output is {"status", "ok", "headers", "body"}, which later steps use as {{steps.notify.output.body.*}}.
  • Only public http and https addresses: private and local addresses are refused, and redirects are not followed.
  • On a dry run or a preview, it is not sent.

To post a message to the team's chat instead, use a chat.notify step.

Example: tell your system when a deal is won

Make an automation on deal with a record_updated trigger, a condition that the stage is your won stage, and the http.request step above. Your endpoint gets one call per won deal.

Was this page useful?

On this page