Light AIDocs Beta Open Light AI

Integrations

Website lead → Jobber request (with preview note)

Website form requests become Jobber clients and requests through Zapier's Jobber app; a second Zap adds the answers and preview to the request when the instant preview is ready.

Two Zaps. The first turns each website form request into a Jobber client and request and saves the request id on the Light AI lead. The second waits for lead.mockup_ready and adds a note to that Jobber request with the form answers, the preview look and the Light AI link. Same flow as the n8n recipe for website forms, using Jobber's own Zapier actions.

RequirementDetails
Light AI planPro or Enterprise (Pro trials included). Free and Plus have no API or webhooks.
Zapier planA paid plan (Professional, Team or Enterprise): multi-step Zap with Webhooks by Zapier. Details
TriggerWebhooks by Zapier → Catch Raw Hook (one per Zap)
Light AI webhook eventslead.created (Zap 1), lead.mockup_ready (Zap 2)
Light AI API keyleads:read and leads:write
Other accountsJobber, connected in Zapier by a Jobber admin

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 lead.created. 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 lead.created.
  6. In the same Filter, add: lead_source exactly matches website_widget, origin_type exactly matches embed, and lead_ref_jobber does not exist.
  7. Action: Jobber → Find or Create Client: search on email (or full_name when there is no e-mail); create with First Name, Last Name, Email, Phone and the property address.
  8. Action: Jobber → Create Request: Client = the client from the previous step, Title = Light AI website request: {{form_name}}, details from answers_text and message where the action has a field for them.
  9. Action: Webhooks by Zapier → Custom Request: save the Jobber request id on the lead (below).

Verify the signature#

Important

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, 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 webhookJavaScript
// 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 if it is shared. The same file is in Downloads.

Write the request id back (Zap 1)#

Custom Request fieldValue
MethodPUT
URLhttps://api.light-ai.app/v1/leads/{{lead_id}}/external_refs/jobber
Data{"id": "{{Request ID}}"}
HeadersAuthorization = Bearer lai_test_…, Content-Type = application/json
Webhooks by Zapier: Custom RequestHTTP
PUT https://api.light-ai.app/v1/leads/{{lead_id}}/external_refs/jobber
Authorization: Bearer lai_test_…
Content-Type: application/json

{"id": "{{Request ID}}"}

Zap 2: add the preview note#

  1. A second Zap with its own Catch Raw Hook and Light AI endpoint for lead.mockup_ready, the same verify step, and a Filter on event_type = lead.mockup_ready.
  2. Action: Delay by Zapier → Delay For 2 minutes, so Zap 1 has saved the request id.
  3. Action: Code by Zapier → Run JavaScript (build the note, below). Then a Filter: only continue if request_id exists.
  4. Action: Jobber → Add Note to Request: Request = request_id, note = note. If the action has a file field, map file_urls into it right away so Jobber keeps copies of the photo and preview.
Code by Zapier: Jobber noteJavaScript
// Code by Zapier → Run JavaScript: reads the lead and builds the Jobber request note.
// Input Data: lead_id (from the verify step), api_key (a lai_test_… or lai_live_… key with leads:read)
const response = await fetch('https://api.light-ai.app/v1/leads/' + encodeURIComponent(inputData.lead_id), {
  headers: { Authorization: 'Bearer ' + inputData.api_key },
});
if (!response.ok) throw new Error('Light AI answered ' + response.status);
const lead = await response.json();
const ref = (lead.external_refs || []).find((r) => r.system === 'jobber');
if (!ref) return { request_id: '' }; // the lead.created Zap has not created the Jobber request yet
const lines = ['Light AI website request' + (lead.form ? ' (' + lead.form.name + ')' : '')];
for (const answer of lead.form_answers || []) lines.push(answer.question + ': ' + (answer.labels || []).join(', '));
const looks = (lead.preview_looks || []).map((look) => look.replace(/_/g, ' '));
if (looks.length) lines.push('Instant preview ready (' + looks.join(', ') + ').');
if (lead.project && lead.project.app_url) lines.push('Photo and preview in Light AI: ' + lead.project.app_url);
const urls = (list) => (list || []).map((asset) => asset && asset.url).filter(Boolean);
return {
  request_id: ref.id,
  note: lines.join('\n'),
  // Signed links that expire after 60 minutes: only for a file field, never as text.
  file_urls: [...urls(lead.assets && lead.assets.photos), ...urls(lead.assets && lead.assets.mockups)].join(','),
};

Webhook payloads carry no image links. GET /v1/leads/{id} returns signed links that expire after 60 minutes: the note links to the project in Light AI instead, and the raw links are only for a file field that copies the files.

Field mapping#

JobberLight AI
Client first and last name, e-mail, phonecontact.*
Client propertyaddress.*
Request title and detailsform.name, form_answers, message
Request noteAnswers, preview_looks, project.app_url
Light AI leadThe request id, saved as external_refs jobber

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.

  1. Create a test key: Settings → Developers → API keys → New key, mode Test, scopes leads:read and leads:write.
  2. API test leads have source: zapier, so turn off the two website conditions in Zap 1's Filter for the test run. lead.mockup_ready only follows a website form request with an instant preview: test Zap 2 with a live request from your own form, then archive that lead.
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"
  },
  "address": {
    "line1": "4102 Oak Hollow Dr",
    "postal_code": "78731"
  }
}'
  1. Pick the lead.created request in Test trigger and test each step; check the client and request in Jobber and the jobber reference on the lead.
  2. Go live: restore the Filter, add Live endpoints for both Zaps, paste each new secret into its verify step and switch to a lai_live_… key.

Errors, retries and duplicates#

  • Duplicates: Find or Create Client reuses an existing client, the Filter skips leads that already carry a jobber reference, and Zap 2 adds a note only once per delivery.
  • If Zap 2 runs before Zap 1 has saved the request id, request_id is empty and the Filter stops it: replay the lead.mockup_ready delivery from Light AI.
  • 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): 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).
  • 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#

  • Approvals made in Jobber can flow back: Jobber → Quote Approved → Custom Request POST /v1/quotes/{id}/mark_approved (quotes:write). See Jobber.

Sources#