For the complete documentation index, see llms.txt. This page is also available as Markdown.

Webhooks

Spara's Webhook support completely customizable configurations.

The Spara platform offers powerful integration capabilities through both outbound webhooks and a Web API.

Not sure whether a webhook is the right tool? See Guide: Webhook, Web API, or Workflow API Step? for a side-by-side comparison.

Webhooks provide real-time notifications of lead events via POST requests to a customer-defined endpoint, enabling automated workflows, external system synchronization, and timely responses to key updates. APIs allow customers to update and enrich lead data, manage user information, and influence the behavior of our AI engine - supporting deep, flexible integrations. All API interactions must be conducted over HTTPS to ensure secure communication.

Both webhooks and API support basic data types via JSON. These types are not explicitly identified in request values.

  • string, ex. "John Doe"

  • integer, ex. 100

  • boolean, i.e. true or false

Malformed values will be rejected, ex. John Doe. Take care to not cast integer or boolean values as strings, ex. "100".

Schema

Spara models leads as a single object with any number of arbitrary fields. For example, if you configure Spara to ask your leads the question "What industry is your company in?" you may decide to name that field industry.

The following fields are standard for all leads:

# Info about the lead.
email(string)
company_name (string)
first_name (string)
last_name (string)
phone_number (string)
job_title (string)
num_employees (integer)

In addition, some leads may have an assigned sales rep in Salesforce:

Webhook Registration & Events

Each customer can register one or more webhook endpoints in the Settings > Webhooks page. Use "Add Webhook" to register additional endpoints, and the trash icon to remove one. Each endpoint has its own URL and its own set of subscribed events, so you can route different events to different destinations.

The following information is required to register a webhook:

  • Webhook URL: A valid HTTPS endpoint where webhook payloads will be sent. Test payloads may be triggered by clicking the "Test" button.

  • API Key(s): Customers must create at least one API Key to enable outbound webhooks. API Keys are shared across all of an organization's webhook endpoints.

  • Events: Select which events trigger webhook notifications for that endpoint.

    • See table below for all event types.

    • NB: If multiple events are triggered at the same time, they are grouped into a single webhook call.

    • Each endpoint only receives the events it is subscribed to; an event is delivered to every endpoint subscribed to it.

Event Name
When the webhook event is triggered
Example

Lead Created

A new lead is created.

Spara Fact Updated

Spara learns a new fact from conversing with the lead.

A lead sends the message "My email is [email protected]."

External Fact Updated

Spara learns of a new fact via query parameters or API. NB: Will not trigger when a new lead is created if Lead created is not selected.

Lead Enrichment Fact Updated

Spara learns of a new fact via lead enrichment.

Lead Message Sent

The lead sends a message.

AI Message Sent

Spara Chat AI sends a message.

Human Message Sent

Human uses "Manual Mode" to send a message to the lead.

Voice Call Ended

A voice call with the lead ends. The payload includes call timestamps, the Voice agent that handled the call, a short summary, and the transcript. For a call Spara reviews you receive this event twice: once the moment the call ends, and again a few seconds later carrying post_call_classification — what Spara determined about the call after listening to the recording.

Payload events and channel sources

Every payload carries two fields that together tell you what happened and where:

  • event — the payload event type: lead.created, lead.updated, or lead.call_transferred.

  • source — the channel that produced the event: chat, voice, email, or, for lead.created, the path that created the lead (see below).

The event names you subscribe to in Settings do not map one-to-one onto payload event types. Several subscriptions produce lead.updated, so filter on source (and on which fields changed) rather than on event alone.

Event (in Settings)

Payload event

source

Lead Created

lead.created

chat, voice, sms, javascript_api, api, crm, deanonymized, outbound

Spara Fact Updated

lead.updated

chat, email

Spara Fact Updated

lead.call_transferred

voice

External Fact Updated

lead.updated

chat, email

Lead Enrichment Fact Updated

lead.updated

chat

Lead Message Sent

lead.updated

chat

AI Message Sent

lead.updated

chat

Human Message Sent

lead.updated

chat

Voice Call Ended

lead.updated

voice

lead.created fires once, when the lead is first created, and its source says how:

source

The lead was created by

chat

The visitor opening a chat. It fires when the chat opens, before the first message.

voice

A voice call, on the website or by phone, from someone who wasn't a lead yet

sms

An incoming text from a new number

javascript_api

A SparaActions.setFields call for a visitor who wasn't a lead yet

api

A POST /leads call to the Leads API

crm

A CRM sync importing a record Spara didn't have

deanonymized

Deanonymization identifying a visitor

outbound

A rep sending an Outbound email to an address no lead had

A lead that later chats or calls again doesn't trigger another lead.created.

lead.call_transferred fires when a Voice agent transfers a live call to a human. It is delivered to endpoints subscribed to Spara Fact Updated — there is no separate subscription for it.

Delivery Format

Each webhook is sent as a JSON payload in the body of an HTTP POST request. Every delivery contains the full lead object — the same object returned by Web API — regardless of which event triggered it. Spara does not send a partial "what changed" diff, so your handler is responsible for comparing against its own last-known state if it needs to detect a specific field change.

The top-level keys are always present:

Key
Description

event

lead.created, lead.updated, or lead.call_transferred

timestamp

When the event fired

source

chat, voice, or email, or for lead.created, one of the values above

object

Always lead

id

The lead's unique identifier

url

Link to the conversation in Spara

created_at / updated_at

When the lead was created and last modified

last_activity_at

The lead's most recent activity (null if the lead has never been active)

data

All known fields on the lead, including custom fields

account

The lead's account, with the account's owner nested inside (null if the lead has no account)

owner

The lead's assigned owner (null if unassigned)

conversation

The chat conversation and its full message history ({} if the lead has no chat thread)

calls

All voice calls on the lead, not just the most recent. Always present; empty array if there are none.

post_call_classification

On each call: who or what Spara determined was on it. null if the call has not been reviewed.

What Spara determined about a call

After a call ends, Spara reviews it — listening to the recording, not just reading the transcript — and records who or what was on the line. The verdict arrives on the call object as post_call_classification.

This is the signal to build on. If your integration needs to know whether a real person was reached, read connection_outcome. It is the most accurate answer Spara has: the review hears the call in full, where anything decided during the call is working from partial audio and has to commit early. Use it in preference to inferring an outcome from call duration, from the transcript, or from the in-call entries in events.

Field
Meaning

connection_outcome

Who or what was on the call. See the values below.

The values depend on which way the call went, because the question differs. On an outgoing call Spara asks who picked up; on an incoming call, nothing was dialled, so it asks what arrived.

Value
Meaning
Outgoing
Incoming

HUMAN

A live person spoke with the agent.

✓

✓

UNCERTAIN

Something was there, but the evidence doesn't identify it.

✓

✓

NO_AUDIO

The recording carries no audible sound.

✓

✓

VOICEMAIL

The call reached a voicemail greeting.

✓

IVR_ONLY

An automated phone system only; no human was reached.

✓

NO_ANSWER

Nobody picked up.

✓

BUSY_REJECTED

Busy signal, or the call was declined.

✓

INVALID_NUMBER

The number could not be reached.

✓

FAILED

The call could not be placed.

✓

ABANDONED

The caller hung up before saying anything.

✓

SPAM_ROBOCALL

An automated caller — a recorded pitch or a dialler.

✓

via_ivr, via_voicemail and message_left describe what an outgoing dial had to get through, so on an incoming call they are false, false and null.

post_call_classification is null on calls Spara has not reviewed. Don't treat that as an outcome — it means no verdict exists.

Review of incoming calls is rolling out. The values are listed above so you can handle them when they start arriving; until then, incoming calls carry null.

You receive this event twice

The review takes a few seconds, and Spara does not hold the call-ended notification back for it. So a reviewed call sends Voice Call Ended when it ends, and sends it again once the verdict exists:

  1. When the call ends — everything except the verdict. post_call_classification is null.

  2. A few seconds later — the same payload with post_call_classification filled in.

Both deliveries carry the lead's full current state rather than a list of changes, so the second is a complete replacement for the first. Process this event idempotently, keyed on the lead or the call, and the second delivery simply updates what you stored. If you only act on the outcome, ignore deliveries where post_call_classification is null and wait for the one that has it.

A call whose review fails sends only the first delivery. Don't wait indefinitely for a second one.

Custom fields you have defined on the lead, account, or owner appear as additional keys alongside the standard ones shown above.

Security

To ensure secure transmission, all webhook payloads include the customer's oldest active API Keys in the X-API-Key header. Customers should verify the API Key before trusting the contents of the webhook.

Webhook URLs must use HTTPS. Plain HTTP endpoints will be rejected during registration.

Delivery Limits & Retry Policy

  • Timeout: Spara waits up to 10 seconds for your endpoint to respond. A slower response is treated as a failed delivery.

  • Retries: If a delivery fails (a non-2xx response or a timeout), Spara retries with exponential backoff — after 2 seconds, then after 4 seconds. That is up to 2 retries in addition to the original attempt. After the final attempt the delivery is dropped.

  • Per-lead rate cap: A single lead can generate at most 20 webhook deliveries per minute. Events beyond that cap are dropped and are not retried. A very fast-moving conversation subscribed to many events can hit this cap.

Design your endpoint to respond quickly, handle retries idempotently, and treat webhooks as best-effort rather than guaranteed delivery. If you need a guaranteed, reconcilable record, back webhooks with a periodic Search Leads (GET) sweep.

Best Practices

  • Validate the API Key of incoming webhook requests before processing.

  • Respond to webhooks with a 200 OK status as quickly as possible.

  • Offload heavy processing to background jobs or message queues.

  • Log and monitor webhook delivery attempts to aid in troubleshooting.

Last updated