# n8n, Zapier and Make

> Connect a site to n8n, Zapier or Make - react to its webhook events and call its REST API with an API key, step by step.

Two building blocks cover almost every automation:

- **Events in**: a webhook endpoint in **Settings › Developers › Webhooks** sends each [event](/developers/webhook-events) to your tool as it happens.
- **Calls out**: an API key from **Settings › Developers › API keys** lets your tool read and change the site through the [REST API](/developers/rest-api).

**Settings › Developers › Quick start** has these snippets with your site's ID filled in.

## n8n

:::steps
### Get events
Add a **Webhook** node, set **HTTP Method** to `POST`, and copy its **Production URL** (activate the workflow so it listens).
In Settings › Developers, press **Add endpoint**, paste the URL and choose the events. Press **Send test event**: the node
shows the request. The record is in `{{ $json.body.data }}` and the event name in `{{ $json.body.type }}`.

### Check the signature (optional)
Before the next nodes, add a **Code** node that checks `X-Vorjo-Signature` against the endpoint's signing secret, as in
[Checking the signature](/developers/webhook-events#checking-the-signature). Turn on **Raw Body** in the Webhook node's options so the
body is exactly what was signed.

### Call the API
Add an **HTTP Request** node. Set **URL** to `https://api.vorjo.com/v1/sites/<site>/orders`, **Authentication** to **Generic Credential
Type › Header Auth**, with **Name** `Authorization` and **Value** `Bearer vsk_…`. For a sync, add the query parameter
`updated_since` with the time of the last run.
:::

## Zapier

:::steps
### Trigger on an event
Make a Zap with **Webhooks by Zapier › Catch Hook** and copy the webhook URL. Add it as an endpoint in Settings › Developers,
choose the events, and press **Send test event**. In Zapier, press **Test trigger**: the fields of `data` can now be used in the
next steps.

### Filter by event
If one endpoint gets several events, add **Filter by Zapier** with `type` (exactly matches) `order.paid`. Or add one endpoint
per Zap, each with its own events.

### Change the site
Add **Webhooks by Zapier › Custom Request**. **Method** `POST`, **URL** `https://api.vorjo.com/v1/sites/<site>/contacts`, **Data**
`{"name": "…", "email": "…"}`, and **Headers** `Authorization` = `Bearer vsk_…` and `Content-Type` = `application/json`.
Add `Idempotency-Key` with a value from the trigger (like its `id`) so a replayed Zap doesn't make a second contact.
:::

## Make

:::steps
### Trigger on an event
Add **Webhooks › Custom webhook**, create a webhook and copy its address. Add it as an endpoint in Settings › Developers and
press **Send test event**, so Make learns the structure. Use a **Router** with a filter on `type` for several events.

### Call the API
Add **HTTP › Make a request**. **URL** `https://api.vorjo.com/v1/sites/<site>/bookings?status=confirmed`, **Method** `GET`, a header
`Authorization` = `Bearer vsk_…`, and **Parse response** on. Lists come as `data` with `hasMore` and `nextCursor`; to read
them all, repeat with `cursor` = the last `nextCursor` until `hasMore` is false.
:::

## Good practice

- **One key per tool**, with only the scopes it needs. Revoke one without breaking the others.
- **Skip repeats**: retries and replays carry the same event `id`. Keep the ids you've handled for a day.
- **Answer fast**: reply `200` first and do slow work after. An answer that takes over 10 seconds counts as failed and is tried again.
- **Watch the Logs tab**: a failing endpoint shows its response code and answer there. Fix it, then press **Replay**.
