---
title: "Quote approved → HighLevel contact tagged"
url: https://docs.light-ai.app/integrations/zapier/quote-approved-to-highlevel.md
canonical_url: https://docs.light-ai.app/integrations/zapier/quote-approved-to-highlevel
last_updated: 2026-11-07
summary: "When a quote is approved, a Zap upserts the HighLevel contact with a light-ai-approved tag, ready to start your won-job workflow."
api_status: beta
related:
  - https://docs.light-ai.app/integrations/zapier
  - https://docs.light-ai.app/webhooks/verify
  - https://docs.light-ai.app/test-mode
  - https://docs.light-ai.app/idempotency
---

# Quote approved → HighLevel contact tagged

> When a quote is approved, a Zap upserts the HighLevel contact with a light-ai-approved tag, ready to start your won-job workflow.

Each approved quote upserts the customer as a HighLevel contact tagged `light-ai-approved` (a tag can start a HighLevel workflow: deposit text, crew booking, review request) and saves the HighLevel contact id on the Light AI client. Same flow as the [n8n template](https://docs.light-ai.app/downloads/n8n/quote-approved-to-highlevel.json).

| Requirement | Details |
| --- | --- |
| Light AI plan | Pro or Enterprise (Pro trials included). Free and Plus have no API or webhooks. |
| Zapier plan | A paid plan (Professional, Team or Enterprise): multi-step Zap with Webhooks by Zapier. [Details](https://docs.light-ai.app/integrations/zapier#what-you-need) |
| Trigger | Webhooks by Zapier → **Catch Raw Hook** |
| Light AI webhook events | `quote.approved` |
| Light AI API key | `clients:write` (for the write-back) |
| Other accounts | HighLevel sub-account with a Private Integration token (contacts scope) |
| n8n version | [Quote approved → HighLevel](https://docs.light-ai.app/downloads/n8n/quote-approved-to-highlevel.json) |

## Build the Zap

1. **Trigger:** Webhooks by Zapier → **Catch Raw Hook**. Copy the webhook URL Zapier shows (raw, not the plain Catch Hook: the signature needs the exact body and the headers).
2. **In Light AI:** Settings → Developers → Webhooks → **Add endpoint**. Paste the Zapier URL, Mode **Test** while you build, events `quote.approved`. Copy the signing secret (`whsec_…`, shown once).
3. Click **Test** on the endpoint (it sends a `ping`), then **Test trigger** in Zapier and pick that request.
4. **Action:** Code by Zapier → **Run JavaScript** with the verification code below. Map Raw Body and the three headers into Input Data (in the field picker they are under Headers, labelled like Webhook Id; the exact labels can differ) and paste the secret into `secret`.
5. **Filter by Zapier:** only continue if `verified` (Boolean) is true **and** `event_type` (Text) exactly matches `quote.approved`.
6. In the same Filter, add: `origin_source_system` does not exactly match `highlevel`, and `client_id` exists.
7. **Action:** Code by Zapier → **Run JavaScript** (below). Type your HighLevel location id into `location_id` (partners: map `grant_reference`) and map the person fields from the verify step.
8. **Action:** Webhooks by Zapier → **Custom Request**: upsert the contact. Data = `body`.
9. **Action:** Webhooks by Zapier → **Custom Request**: add the `light-ai-approved` tag with the Contact Id from the upsert answer. It is a separate request because tags sent in an upsert replace the contact's existing tags; this one adds to them.
10. **Action:** Webhooks by Zapier → **Custom Request**: save the contact id on the Light AI client.

## Verify the signature

> **Warning:** Zapier cannot check Light AI's HMAC signature by itself: a Catch Hook URL accepts anything anyone posts to it. This Code by Zapier step recomputes the [Standard Webhooks signature](https://docs.light-ai.app/webhooks/verify), rejects deliveries older than 5 minutes and, once verified, returns the event as simple fields. Keep the Filter right after it so nothing unverified reaches your CRM.

**Code by Zapier: verify Light AI webhook**

```javascript
// Code by Zapier → Run JavaScript, right after Webhooks by Zapier → Catch Raw Hook.
// Input Data (name on the left, value on the right):
//   raw_body           Raw Body, from the Catch Raw Hook step
//   webhook_id         the webhook-id header
//   webhook_timestamp  the webhook-timestamp header
//   webhook_signature  the webhook-signature header
//   secret             the endpoint's signing secret (whsec_…), typed in
// Next step: a Filter that only continues if "verified" is true.
const crypto = require('crypto');
const TOLERANCE_SECONDS = 300;

const raw = String(inputData.raw_body || '');
const id = String(inputData.webhook_id || '').trim();
const timestamp = String(inputData.webhook_timestamp || '').trim();
const signatures = String(inputData.webhook_signature || '').trim().split(' ');
const secret = String(inputData.secret || '').trim();

if (!raw || !id || !timestamp || !secret) return { verified: false, reason: 'missing body, header or secret' };
if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE_SECONDS) {
  return { verified: false, reason: 'timestamp outside tolerance' };
}
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
const expected = Buffer.from('v1,' + crypto.createHmac('sha256', key).update(id + '.' + timestamp + '.' + raw).digest('base64'));
const valid = signatures.some((entry) => {
  const candidate = Buffer.from(entry);
  return candidate.length === expected.length && crypto.timingSafeEqual(candidate, expected);
});
if (!valid) return { verified: false, reason: 'signature mismatch' };

// Verified: flatten the event into fields later steps can map.
const event = JSON.parse(raw);
const o = (event.data && event.data.object) || {};
const text = (value) => (value === null || value === undefined ? '' : String(value));
const refs = (prefix, list) => Object.fromEntries((list || []).map((ref) => [prefix + '_ref_' + ref.system, text(ref.id)]));
const out = {
  verified: true, reason: '', webhook_id: id, event_id: text(event.id), event_type: text(event.type),
  livemode: event.livemode === true, origin_type: text(event.origin && event.origin.type),
  origin_source_system: text(event.origin && event.origin.source_system),
  organization_id: text(event.organization && event.organization.id),
  grant_reference: text(event.grant && event.grant.external_reference),
};
const person = (p, address) => Object.assign(out, {
  first_name: text(p.first_name), last_name: text(p.last_name),
  full_name: [p.first_name, p.last_name].filter(Boolean).join(' '),
  email: text(p.email), phone: text(p.phone),
  address: text(address.formatted), address_line1: text(address.line1 || address.formatted), city: text(address.city),
  region: text(address.region), postal_code: text(address.postal_code), country: text(address.country),
});
if (o.object === 'lead') {
  person(o.contact || {}, o.address || {});
  Object.assign(out, {
    lead_id: text(o.id), lead_source: text(o.source), lead_status: text(o.status), needs_address: o.needs_address === true,
    service_interest: text(o.service_interest), message: text(o.message), submitted_at: text(o.submitted_at),
    form_id: text(o.form && o.form.id), form_name: text(o.form && o.form.name), mockup_status: text(o.mockup_status),
    preview_looks: (o.preview_looks || []).join(', '),
    answers_text: (o.form_answers || []).map((a) => a.question + ': ' + ((a.labels || []).join(', ') || text(a.value))).join('\n'),
    project_id: text(o.project && o.project.id), project_app_url: text(o.project && o.project.app_url),
    gclid: text(o.attribution && o.attribution.gclid),
  }, refs('lead', o.external_refs));
}
if (o.object === 'quote') {
  const client = o.client || {};
  const totals = o.totals || {};
  const money = (m) => (m && m.decimal) || '';
  person(client, (o.property && o.property.address) || {});
  Object.assign(out, {
    quote_id: text(o.id), quote_status: text(o.status), quote_title: text(o.title), currency: text(o.currency),
    total: money(totals.total), total_cents: totals.total ? totals.total.cents : 0, subtotal: money(totals.subtotal),
    deposit: money(totals.deposit && totals.deposit.amount), truncated: o.truncated === true,
    line_items_text: (o.line_items || []).filter((item) => item.selected !== false)
      .map((item) => [item.name, item.quantity !== null && item.quantity !== undefined ? item.quantity + ' ' + text(item.unit) : '', money(item.amount)].filter(Boolean).join(' · '))
      .join('\n'),
    sent_at: text(o.sent_at), approved_at: text(o.approved_at), declined_at: text(o.declined_at), expires_at: text(o.expires_at),
    view_count: (o.engagement && o.engagement.view_count) || 0, first_viewed_at: text(o.engagement && o.engagement.first_viewed_at),
    app_url: text(o.links && o.links.app_url), customer_url: text(o.links && o.links.customer_url),
    rep_name: text(o.assigned_rep && o.assigned_rep.name), rep_email: text(o.assigned_rep && o.assigned_rep.email),
    project_id: text(o.project && o.project.id), client_id: text(client.id), lead_id: text(o.lead && o.lead.id),
  }, refs('project', o.project && o.project.external_refs), refs('client', client.external_refs), refs('quote', o.external_refs));
}
return out;
```

The secret sits in the Zap, so anyone who can edit the Zap can read it: keep the Zap in a private folder and [rotate the secret](https://docs.light-ai.app/webhooks/verify#rotating-the-secret) if it is shared. The same file is in [Downloads](https://docs.light-ai.app/downloads/zapier/verify-light-ai-webhook.txt).

## Build and send the contact

**Code by Zapier: HighLevel contact**

```javascript
// Code by Zapier → Run JavaScript: builds the HighLevel contact upsert body.
// Input Data: location_id (typed in, or map grant_reference for partner accounts),
//   first_name, last_name, full_name, email, phone, address_line1, city, region, postal_code
const v = (name) => String(inputData[name] || '').trim() || undefined;
const contact = {
  locationId: v('location_id'),
  firstName: v('first_name'), lastName: v('last_name'), name: v('full_name') || 'Light AI customer',
  email: v('email'), phone: v('phone'),
  address1: v('address_line1'), city: v('city'), state: v('region'), postalCode: v('postal_code'),
  source: 'Light AI',
  // No tags here: tags in an upsert replace the contact's existing tags. The tag is added in its own request.
};
if (!contact.locationId) throw new Error('Set location_id to your HighLevel location id');
return { body: JSON.stringify(contact), location_id: contact.locationId };
```

| Custom Request field | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://services.leadconnectorhq.com/contacts/upsert` |
| Data | `{{body}}` |
| Headers | `Authorization` = `Bearer pit-…`, `Content-Type` = `application/json`, `Version` = `2021-07-28` |

**Upsert the contact**

```http
POST https://services.leadconnectorhq.com/contacts/upsert
Authorization: Bearer pit-…
Content-Type: application/json
Version: 2021-07-28

{{body}}
```

| Custom Request field | Value |
| --- | --- |
| Method | `POST` |
| URL | `https://services.leadconnectorhq.com/contacts/{{Contact Id}}/tags` |
| Data | `{"tags": ["light-ai-approved"]}` |
| Headers | `Authorization` = `Bearer pit-…`, `Content-Type` = `application/json`, `Version` = `2021-07-28` |

**Add the tag (keeps existing tags)**

```http
POST https://services.leadconnectorhq.com/contacts/{{Contact Id}}/tags
Authorization: Bearer pit-…
Content-Type: application/json
Version: 2021-07-28

{"tags": ["light-ai-approved"]}
```

## Write the contact id back

| Custom Request field | Value |
| --- | --- |
| Method | `PUT` |
| URL | `https://api.light-ai.app/v1/clients/{{client_id}}/external_refs/highlevel` |
| Data | `{"id": "{{Contact Id}}", "namespace": "{{location_id}}"}` |
| Headers | `Authorization` = `Bearer lai_test_…`, `Content-Type` = `application/json` |

**Webhooks by Zapier: Custom Request**

```http
PUT https://api.light-ai.app/v1/clients/{{client_id}}/external_refs/highlevel
Authorization: Bearer lai_test_…
Content-Type: application/json

{"id": "{{Contact Id}}", "namespace": "{{location_id}}"}
```

## Field mapping

| HighLevel contact | Light AI |
| --- | --- |
| `firstName`, `lastName`, `email`, `phone` | `client.*` |
| `address1`, `city`, `state`, `postalCode` | `property.address.*` |
| Tag (added, existing tags kept) | `light-ai-approved` |
| `source` | `Light AI` |

## Test with test data

Build and test against test data only: a `lai_test_…` key, a **Test** endpoint and the test helpers. Test objects never reach the contractor's pipeline, never e-mail anyone and are deleted after 7 days.

Create a test key: Settings → Developers → API keys → **New key**, mode **Test**, scopes `leads:read`, `leads:write` and `clients:write`.

Create a test lead with your test key, publish a test quote for it, then simulate the homeowner. The key needs `leads:read`: without it `POST /v1/leads` answers with a receipt instead of the `lead_…` id. Each call emits the real event to your test endpoint. Use the `lead_…` id from the first answer.

curl:

```bash
curl -X POST "https://api.light-ai.app/v1/leads" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "source": "zapier",
  "contact": {
    "first_name": "Dana",
    "last_name": "Reyes",
    "email": "dana@example.com",
    "phone": "+1 512 555 0134"
  },
  "address": {
    "line1": "4102 Oak Hollow Dr",
    "city": "Austin",
    "region": "TX",
    "postal_code": "78731"
  }
}'
```

JavaScript:

```javascript
const response = await fetch('https://api.light-ai.app/v1/leads', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LIGHT_AI_API_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "source": "zapier",
    "contact": {
      "first_name": "Dana",
      "last_name": "Reyes",
      "email": "dana@example.com",
      "phone": "+1 512 555 0134"
    },
    "address": {
      "line1": "4102 Oak Hollow Dr",
      "city": "Austin",
      "region": "TX",
      "postal_code": "78731"
    }
  }),
});
const data = await response.json();
```

Python:

```python
import os, uuid, requests

response = requests.post(
    "https://api.light-ai.app/v1/leads",
    headers={
        "Authorization": f"Bearer {os.environ['LIGHT_AI_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "source": "zapier",
        "contact": {
            "first_name": "Dana",
            "last_name": "Reyes",
            "email": "dana@example.com",
            "phone": "+1 512 555 0134"
        },
        "address": {
            "line1": "4102 Oak Hollow Dr",
            "city": "Austin",
            "region": "TX",
            "postal_code": "78731"
        }
    },
)
data = response.json()
```

curl:

```bash
curl -X POST "https://api.light-ai.app/v1/test_helpers/leads/lead_…/publish_quote" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

JavaScript:

```javascript
const response = await fetch('https://api.light-ai.app/v1/test_helpers/leads/lead_…/publish_quote', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LIGHT_AI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

Python:

```python
import os, requests

response = requests.post(
    "https://api.light-ai.app/v1/test_helpers/leads/lead_…/publish_quote",
    headers={
        "Authorization": f"Bearer {os.environ['LIGHT_AI_API_KEY']}",
    },
    json={},
)
data = response.json()
```

curl:

```bash
curl -X POST "https://api.light-ai.app/v1/test_helpers/leads/lead_…/approve_quote" \
  -H "Authorization: Bearer $LIGHT_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

JavaScript:

```javascript
const response = await fetch('https://api.light-ai.app/v1/test_helpers/leads/lead_…/approve_quote', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LIGHT_AI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

Python:

```python
import os, requests

response = requests.post(
    "https://api.light-ai.app/v1/test_helpers/leads/lead_…/approve_quote",
    headers={
        "Authorization": f"Bearer {os.environ['LIGHT_AI_API_KEY']}",
    },
    json={},
)
data = response.json()
```

1. In Zapier, **Test trigger** again and pick the `quote.approved` request, then test each step. The verify step should say `verified: true`.
2. Check the record in the other app, then check the write-back (if the recipe has one) with a `GET` on the Light AI object.
3. **Go live:** turn the Zap on, add a **Live** endpoint with the same URL and events in Light AI, paste its new secret into the verify step, replace `lai_test_…` with a `lai_live_…` key, and delete the test endpoint. Or keep a duplicate of the Zap for testing.

## Errors, retries and duplicates

- Duplicates: HighLevel's upsert matches on e-mail or phone and adding a tag twice changes nothing, so a repeated delivery is harmless. A workflow started by the tag runs once per tag add.
- Zapier answers `200` the moment the hook receives a request, so Light AI records the delivery as delivered. Failures after that show up in **Zap history**, not in Light AI's delivery log.
- To resend after fixing a step, use Light AI's **Retry** in the delivery log (`POST /v1/webhook_deliveries/{id}/retry`) or **Replay** (`POST /v1/webhook_endpoints/{id}/replay`): both sign the delivery again. A Zapier re-run that executes the verify step more than 5 minutes after the delivery returns `verified: false` by design.
- Deliveries are at least once and replays reuse the `webhook-id`, so the same event can reach the Zap twice. Each recipe below has a guard against duplicates; keep it.
- Events are not ordered. Map from the event you receive (it is rendered when it is sent) rather than assuming an earlier one arrived first.
- Turning the Zap off makes Zapier answer `404` (it can take hours to start). Light AI then retries for about 4 days and disables the endpoint, so disable or delete the endpoint in Light AI when you turn a Zap off.
- Light AI errors are JSON with a `code` (see [Errors](https://docs.light-ai.app/errors)): `401 invalid_api_key` (wrong or mistyped key), `403 insufficient_scope` (the key lacks the scope above), `422 validation_failed` (`errors[]` names each field), `429 rate_limited` with `Retry-After` (60 writes a minute per key by default, see [Rate limits](https://docs.light-ai.app/rate-limits)).
- Turn on Zapier's **Autoreplay** where your plan has it, or replay a failed run by hand: the `Idempotency-Key` and the `external_ref` make the retry safe.

## Notes

- No-code alternative: LeadConnector → **Add/Update Contact** with the same fields, instead of the Code step and upsert. Before relying on its tags field, check on a test contact whether it adds the tag or replaces the existing ones.
- Move an opportunity instead: LeadConnector → **Add/Update Opportunity** with status won and `total` as the value.

## Sources

- [LeadConnector on Zapier](https://zapier.com/apps/leadconnector/integrations)
- [HighLevel upsert contact](https://marketplace.gohighlevel.com/docs/ghl/contacts/upsert-contact)
- [Webhooks by Zapier](https://help.zapier.com/hc/en-us/articles/8496288690317)
