API reference
The SparkOps API
Send contacts to SparkOps from your website or your CRM, stop texting someone who unsubscribed somewhere else, end a campaign your team closed, and hear what happened next through webhooks.
Introduction
The API does what the same buttons in SparkOps do, under the same rules: the same quiet hours, the same opt-outs, one active conversation per person. Each request carries an API key, a POST sends a JSON body (or a form, its nested fields named like address__street), and each answer is JSON.
Getting started
- Make a key. In SparkOps, go to Setup › API and press Create a key (an owner or manager can). Copy it; an owner or manager can show it again there later.
- Copy a campaign's id. Setup › API lists every published, live campaign with its id.
- Send a contact. Start a campaign with their phone and that id. Their first text goes out, and the conversation shows up in your inbox.
https://app.sparkops.comcurl https://app.sparkops.com/api/v1/conversations \
-H "Authorization: Bearer $SPARKOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "(512) 555-0199",
"first_name": "Jordan",
"last_name": "Reyes",
"email": "jordan@example.com",
"crm_id": "HS-1042",
"address": {
"street": "1100 Congress Ave",
"city": "Austin",
"state": "TX",
"postal_code": "78701"
},
"metadata": {
"unit_age": "12 years"
},
"campaign_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"source": "Google"
}'Authentication
Every request sends a key in the Authorization header. A key looks like spk_ and 43 letters, digits, - and _. It belongs to one business and can start campaigns, opt people out and end conversations for it.
Keep a key on your server, never in a web page. An owner or manager of your business can show a key again in Setup › API, and each time is recorded. An older key that Setup says can't be shown can't be recovered, so if it's lost, make another. If one leaks, revoke it in Setup › API; every request with it is refused from then on. Every change a key makes to a contact, and every campaign it starts, is recorded with the key's name.
A missing, malformed, unknown or revoked key answers 401 unauthorized, and nothing is read or written.
Authorization: Bearer spk_...{
"error": {
"code": "unauthorized",
"message": "Send your SparkOps API key as: Authorization: Bearer <key>. Keys are made in Setup › API."
}
}Requests and answers
- Send JSON with
Content-Type: application/json, or a form (application/x-www-form-urlencodedormultipart/form-data). In a form, a nested field is written with two underscores:address__city,metadata__unit_age. - A body is at most 32 KB.
- Every answer is JSON. A refusal is
{ "error": { "code", "message", "field" } }:codeis for your code,messageis for a person, andfieldnames the field for aninvalid_request. - Every answer to a request whose key is accepted carries
RateLimit-Limit,RateLimit-RemainingandRateLimit-Reset.
Rate limits
120 requests a minute per business, across all its keys. RateLimit-Remaining says how many are left this minute and RateLimit-Reset how many seconds until the next. Over the limit, the answer is 429 rate_limited with Retry-After, the seconds to wait. Nothing is done for a request that was limited, so it's safe to send again.
The same request twice
Networks drop answers and clients retry, so a request that starts a campaign is safe to send again. Send an Idempotency-Key header (up to 200 visible characters, such as your form submission's id), or none and SparkOps keys the request by its body. Sent again within 24 hours, it answers 200 with the same conversation and "replayed": true, and nothing happens twice: no second text, and no second conversation. A request keyed by its body counts as the same only while the conversation it started is still going: once that campaign has ended, the same body starts a new conversation, so a contact sent again later is texted again. A conversation SparkOps closed as a landline is the exception: it ended the moment it was made, and its body still returns it for the 24 hours, so a retry makes no second.
The same Idempotency-Key with a different body answers 422 idempotency_key_reused. A request that was refused (they were already in a conversation, say) is decided again when it's sent again, because what refused it may have changed.
Idempotency-Key: form-submission-81723Errors
Every refusal has a code. A 409 is about the person or the campaign, not the request: their details were still saved, and the answer says why nothing started.
- 400invalid_bodyThe body isn't a JSON object or a form, or is over 32 KB.
- 401unauthorizedThe key is missing, malformed, unknown or revoked.
- 404not_foundNo conversation or contact has that id in this business.
- 404no_active_conversationNobody with that number, CRM id or contact id is in an active conversation.
- 409opted_outThe person opted out of texts. Nothing was started or sent; their details were still saved.
- 409another_activeThe person is already in an active conversation.
active_conversationsays which, and who holds it. - 409campaign_unavailableNo published, live campaign has that
campaign_id. - 409campaign_archivedThat campaign is archived, so nobody new joins it. Nothing was started or sent; the person's details were still saved. Reactivate it in SparkOps, or send another
campaign_id. - 409opening_unusableThe campaign's first text can't be filled in, so it can't be sent.
- 409no_numberThe business has no number in use to text from.
- 409a2p_not_approvedThe business's A2P campaign isn't approved, so it can't start conversations yet. Nothing was started or sent; the person's details were still saved.
- 409sends_stoppedSparkOps has stopped this business's automated texting for now, so it can't start conversations. Nothing was started or sent; the person's details were still saved.
- 422invalid_requestA field is missing or can't be used.
fieldnames it. - 422invalid_phoneThe phone isn't a US mobile number SparkOps can text.
- 422idempotency_key_reusedThis
Idempotency-Keywas used for a different request in the last 24 hours. - 429rate_limitedThe business sent 120 requests this minute.
Retry-Aftersays when to try again. - 503not_set_upTexting isn't set up correctly for this business. Nothing was started or sent.
Start a campaign
POST/api/v1/conversations
Starts a published, live campaign for someone: their contact is found by phone or made, and the campaign's opening goes out.
An inquiry (the default: they just asked you to get in touch) gets its opening at once, at any hour, as a reply. Outreach waits for the texting hours of where they live, which SparkOps works out from their address, or else their area code, and for your business's hours if you've set them. Send entry: "outreach" for anyone who didn't just ask (someone from a list, an old form, a CRM you're working through): otherwise they're texted at once, even at night.
What happens to the contact: they are found by their number within your business, or made. A field left out, null, empty or only spaces changes nothing: nothing a request says clears a value. A value replaces what's stored when it differs. An address replaces the stored one whole. Metadata merges field by field. A value that can't be used (an email that isn't one) is skipped and named under contact.ignored, and the rest is saved; so is a field SparkOps doesn't know. The contact is updated even when the conversation is refused (they opted out, or are already in one), but not when the request itself can't be read. Every change is recorded with the key that made it.
Fields
- phonestring · requiredA US mobile number, in any form: (619) 555-0142, 619-555-0142, +16195550142.
- campaign_idstring (uuid) · requiredThe campaign to start. Setup › API lists each live campaign's id.
- entry"inquiry" or "outreach"inquiry (the default) if they just asked you to get in touch: the opening goes at once, at any hour. outreach if you're reaching out: the opening waits for their texting hours, and your business's hours if you've set them.
- sourcestringWhere they came from, in your words: "Google", "Website", "Referral". Up to 100 characters. It comes back in answers and webhooks, and Insights counts conversations by it.
- first_namestringOptional.
- last_namestringOptional.
- emailstringOptional.
- crm_idstringYour CRM's id for this person, up to 100 characters. Unique within your business: an id another of your contacts has is skipped and named (
crm_id_in_use). It comes back in answers and webhooks, and can end a campaign or opt someone out instead of a phone. The phone still identifies the person. - addressobjectstreet, city, state (two letters or the name) and postal_code. Its state sets their texting hours.In a form:
address__street, address__city, address__state, address__postal_code - metadataobjectYour own fields, such as a unit's age: up to 25, each named with letters, digits and _, each value text (up to 500 characters), a number, or true or false. Each key becomes a merge field in the campaign editor once it has come in with a contact.In a form:
metadata__unit_age
Answers
- 201A new conversation.
opening.statusis the opening's state:held(withheld_untilandreason) while it waits for their texting hours, thensent,delivered,undelivered,failedorcancelled; ornot_sent, with itsreason, for a conversation recorded and closed without a text:landline: Twilio says their number is a landline, which can't receive texts, and they have never texted you: the conversation is recorded already ended, Disqualified with the reason Landline (soconversation.disqualifiedis sent), and nothing is sent to them.qualification,outcomeanddisqualification_reasonsay how the conversation stands, as the webhooks do: allnullwhile it's going. - 200The same request again within 24 hours: the same conversation,
replayed: true. Without anIdempotency-Key, only while that conversation hasn't ended (after that, the same body starts a new one), except one SparkOps closed as a landline, which it returns for the 24 hours. - 409another_activeThe person is already in an active conversation.
active_conversationsays which, and who holds it.held_byisai,person(withperson, their name) orunassigned(with your team, nobody on it yet). - 409opted_outThe person opted out of texts. Nothing was started or sent; their details were still saved.
- 409campaign_unavailableNo published, live campaign has that
campaign_id. - 409campaign_archivedThat campaign is archived, so nobody new joins it. Nothing was started or sent; the person's details were still saved. Reactivate it in SparkOps, or send another
campaign_id. - 409opening_unusableThe campaign's first text can't be filled in, so it can't be sent.
- 409no_numberThe business has no number in use to text from.
- 409a2p_not_approvedThe business's A2P campaign isn't approved, so it can't start conversations yet. Nothing was started or sent; the person's details were still saved.
- 409sends_stoppedSparkOps has stopped this business's automated texting for now, so it can't start conversations. Nothing was started or sent; the person's details were still saved.
- 422invalid_requestA field is missing or can't be used.
fieldnames it. - 422invalid_phoneThe phone isn't a US mobile number SparkOps can text.
- 422idempotency_key_reusedThis
Idempotency-Keywas used for a different request in the last 24 hours. - 503not_set_upTexting isn't set up correctly for this business. Nothing was started or sent.
curl https://app.sparkops.com/api/v1/conversations \
-H "Authorization: Bearer $SPARKOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "(512) 555-0199",
"first_name": "Jordan",
"last_name": "Reyes",
"email": "jordan@example.com",
"crm_id": "HS-1042",
"address": {
"street": "1100 Congress Ave",
"city": "Austin",
"state": "TX",
"postal_code": "78701"
},
"metadata": {
"unit_age": "12 years"
},
"campaign_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"source": "Google"
}'{
"conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"contact_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"campaign_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"entry": "inquiry",
"created_via": "api",
"source": "Google",
"qualification": null,
"outcome": null,
"disqualification_reason": null,
"opening": {
"status": "sent"
}
},
"replayed": false,
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"crm_id": "HS-1042",
"changes": [
{
"field": "first_name",
"from": null,
"to": "Jordan"
},
{
"field": "last_name",
"from": null,
"to": "Reyes"
},
{
"field": "email",
"from": null,
"to": "jordan@example.com"
},
{
"field": "crm_id",
"from": null,
"to": "HS-1042"
},
{
"field": "address_street",
"from": null,
"to": "1100 Congress Ave"
},
{
"field": "address_city",
"from": null,
"to": "Austin"
},
{
"field": "address_state",
"from": null,
"to": "TX"
},
{
"field": "address_postal_code",
"from": null,
"to": "78701"
},
{
"field": "metadata.unit_age",
"from": null,
"to": "12 years"
}
],
"ignored": []
}
}Sent: the same request
{
"conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"contact_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"campaign_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"entry": "inquiry",
"created_via": "api",
"source": "Google",
"qualification": null,
"outcome": null,
"disqualification_reason": null,
"opening": {
"status": "sent"
}
},
"replayed": true,
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"crm_id": "HS-1042",
"changes": [],
"ignored": []
}
}Sent: {"phone":"(512) 555-0000","first_name":"Casey","campaign_id":"3b6f1d2e-8c4a-4f7e-9a1b-00000000c001","source":"Website"}
{
"conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a002",
"contact_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b002",
"campaign_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"entry": "inquiry",
"created_via": "api",
"source": "Website",
"qualification": "disqualified",
"outcome": "closed_no_result",
"disqualification_reason": "Landline",
"opening": {
"status": "not_sent",
"reason": "landline"
}
},
"replayed": false,
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b002",
"crm_id": null,
"changes": [
{
"field": "first_name",
"from": null,
"to": "Casey"
}
],
"ignored": []
}
}Sent: {"phone":"(512) 555-0199","campaign_id":"3b6f1d2e-8c4a-4f7e-9a1b-00000000c002"}
{
"error": {
"code": "another_active",
"message": "This person is already in an active conversation. Nothing was started or sent."
},
"active_conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"campaign": "New website inquiries",
"held_by": "ai"
},
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"crm_id": "HS-1042",
"changes": [],
"ignored": []
}
}Sent: {"phone":"(512) 555-0199"}
{
"error": {
"code": "invalid_request",
"message": "campaign_id is required: copy it from Setup › API.",
"field": "campaign_id"
}
}End a campaign
POST/api/v1/conversations/end
Ends a conversation's campaign now, as "Closed, no result", for someone your team already handled some other way.
The AI stops starting texts, anything waiting to be sent is cancelled, and follow-ups stop. A conversation someone on your team has open stays open with them; one the AI holds is released, so a new campaign can start for the person. If they text again, the AI still answers, as after any outcome. It sends no webhook: your system ended it, so it already knows.
Fields
- conversation_idstring (uuid) · one of theseThe id a Start a campaign request answered with.
- contact_idstring (uuid) · one of theseA contact's id, from a Start a campaign answer or a webhook: ends their active conversation.
- phonestring · one of theseTheir number: ends their active conversation.
- crm_idstring · one of theseYour CRM's id for them: ends their active conversation.
Answers
- 200Ended.
already_ended: truefor one that had already ended; nothing changes. - 404not_foundNo conversation or contact has that id in this business.
- 404no_active_conversationNobody with that number, CRM id or contact id is in an active conversation.
- 422invalid_requestA field is missing or can't be used.
fieldnames it.
curl https://app.sparkops.com/api/v1/conversations/end \
-H "Authorization: Bearer $SPARKOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "(512) 555-0199"
}'{
"conversation_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"ended": true,
"already_ended": false
}Opt someone out
POST/api/v1/opt-outs
Stops every text from your business to a person, for someone who unsubscribed somewhere else.
Everything waiting to be sent to them is cancelled, their follow-ups stop, and every conversation of theirs ends as Opted out. Nobody is texted to confirm it: they didn't ask by text. A number SparkOps doesn't know yet becomes a contact who has opted out, so a later request can't start a campaign for them.
Fields
- phonestring · one of theseA US number in any form, or E.164 (+ and the country code).
- contact_idstring (uuid) · one of theseA contact's id, from a Start a campaign answer.
- crm_idstring · one of theseYour CRM's id for them. Someone SparkOps doesn't know by it is not found: without a phone it can't make a contact.
- notestringKept with the opt-out, up to 500 characters: "Unsubscribed in HubSpot".
Answers
- 200Opted out.
already_opted_out: trueif they already were; nothing changes. - 404not_foundNo conversation or contact has that id in this business.
- 422invalid_requestA field is missing or can't be used.
fieldnames it.
curl https://app.sparkops.com/api/v1/opt-outs \
-H "Authorization: Bearer $SPARKOPS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "(512) 555-0199",
"note": "Unsubscribed in HubSpot"
}'{
"contact_id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"opted_out": true,
"already_opted_out": false
}Who am I
GET/api/v1/me
Says which business a key belongs to, and the key's own name: a quick check that a key works.
It reads nothing else.
Fields
None: the key is all it needs.
Answers
- 200The business and the key's name.
curl "https://app.sparkops.com/api/v1/me" \
-H "Authorization: Bearer $SPARKOPS_API_KEY"{
"business": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001",
"name": "Coastal Comfort Heating & Air"
},
"key": {
"name": "Website form"
}
}List campaigns
GET/api/v1/campaigns
Lists the campaigns a request can start, by name, with the `campaign_id` Start a campaign takes.
Only live campaigns: published, and not paused or archived. Setup › API lists the same ones.
Fields
None: the key is all it needs.
Answers
- 200Each live campaign's
idandname, by name.
curl "https://app.sparkops.com/api/v1/campaigns" \
-H "Authorization: Bearer $SPARKOPS_API_KEY"{
"campaigns": [
{
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"name": "New website inquiries"
},
{
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c002",
"name": "Spring tune-ups"
}
]
}Webhooks
SparkOps tells your system what happened next: a contact replied, called or was called, reached a result (a booking, say) and so qualified, turned out not to be a fit, opted out, or needs your team. Each event is a POST of JSON to an address you register, signed so you can check it came from SparkOps.
- In Setup › API › Webhooks, press Add an endpoint: its URL and the events it wants.
- Copy its signing secret (
whsec_and 44 characters): it's shown once. - Press Send a test event: SparkOps sends a
testevent at once and shows how your endpoint answered.
An endpoint must be https://, on the public internet, with no user or password in its address. SparkOps refuses an address on a private network, when you add it and every time it sends. A business has up to 10 endpoints. Remove one in Setup; anything still waiting to go to it is dropped.
Events
- conversation.startedNew conversation in SetupA new conversation starts, however it starts: from the API, in the app (an enrollment, an upload, a person's first text), someone new texting your number, or someone calling or texting a Receptionist number.
conversation.created_viasays how it came in:api,app,inbound_textorinbound_call. A one-time text campaign's conversation starts already ended: its one text is sent (or waits for their texting hours) and itsoutcomeisone_time_text_sent, which is never a result and never sendsconversation.qualified.An example
conversation.started{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.started", "created_at": "2026-09-29T16:58:03.120Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": null, "last_name": null, "email": null, "crm_id": null, "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "inbound_call", "source": null, "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "engaging", "qualification": null, "outcome": null, "disqualification_reason": null, "appointment": null, "answers": {}, "additional_info": {}, "summary": "", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": null } } } - conversation.activityActivity in SetupA text arrives from the contact, or one goes to them (the carrier took it). Adds
data.message.An example
conversation.activity{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.activity", "created_at": "2026-09-29T17:03:40.020Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "engaging", "qualification": null, "outcome": null, "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons" }, "additional_info": {}, "summary": "What's going on with your system?\nThe upstairs unit blows warm air in the afternoons", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": null }, "message": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000d001", "direction": "inbound", "body": "Thursday at 3 works", "author": "contact", "person": null, "status": "delivered", "at": "2026-09-29T17:03:39.870Z" } } } - conversation.callCall in SetupA call with the contact ended: one the AI answered, one that rang your team (answered or not), one your team placed, one SparkOps placed for the AI because the contact asked to be called back (answered or not), or one nobody could take. Sent once a call, when its record is complete: within seconds of its end, or about half a minute after a call the AI took, so
conversation.answersholds what the call learned. A SparkTransfer call sends its own two events instead. Addsdata.call.An example
conversation.call{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.call", "created_at": "2026-09-29T17:03:27.400Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "engaging", "qualification": null, "outcome": null, "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "What's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": null }, "call": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a601", "direction": "inbound", "answered_by": "ai", "person": null, "status": "completed", "duration_seconds": 255, "started_at": "2026-09-29T16:58:40.000Z", "ended_at": "2026-09-29T17:02:55.000Z", "transcript": "Assistant: Hi, this is Coastal Comfort Heating & Air. What's going on with your system?\nContact: The upstairs unit blows warm air in the afternoons.\nAssistant: Sorry about that. How old is the system?\nContact: About 12 years.\nAssistant: Thanks, Jordan. We'll text you to set up a visit." } } } - conversation.needs_attentionNeeds a person in SetupA conversation goes to your team with nobody on it: the AI handed it over, a takeover rule fired, or someone new texted in. It can also come for a conversation a teammate already holds, which stays theirs (
held_byisperson), when a booking the AI started finishes after they took it: a takeover rule fires on the result (takeover_rule), or the booking couldn't be confirmed (cant_book); or a cancel or a move of the contact's appointment the AI started couldn't be finished (cant_change). Addsdata.reason.An example
conversation.needs_attention{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.needs_attention", "created_at": "2026-09-29T17:05:02.118Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "unassigned", "person": null, "open": true, "state": "engaging", "qualification": null, "outcome": null, "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "What's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": null }, "reason": "asked_for_person" } } - conversation.qualifiedQualified in SetupThe contact reached a result, and so is Qualified, by the AI or a person: a booking, a time to call, the details you wanted, or a transfer; or by SparkOps from a SparkTransfer call (its
resultspark_transfer). Sent each time a result is recorded, including a different one or a new time for a soft appointment. An appointment the AI booked in your calendar isappointment_booked, sent once the calendar confirms it, with the booking inconversation.appointment. Other endings aren't results and never send it: a contact closed as not a fit sendsconversation.disqualified, and one who opts out sendscontact.opted_out. "Closed, no result" with no verdict (qualification: null, set by a person or by End a campaign), and an older conversation ended because a newer campaign started for them (superseded), send no webhook.An example
conversation.qualified{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.qualified", "created_at": "2026-09-29T17:04:12.345Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "ended", "qualification": "qualified", "outcome": "appointment_soft", "disqualification_reason": null, "appointment": { "kind": "soft", "status": null, "words": "Thursday, October 1, 3pm", "day": "2026-10-01", "time": "15:00", "part_of_day": null, "starts_at": "2026-10-01T20:00:00.000Z", "ends_at": null, "time_zone": "America/Chicago", "meeting_type": null, "provider": null }, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "Qualified · Soft appointment\nAppointment: Thursday, October 1, 3pm\n\nWhat's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": "2026-09-29T17:04:12.345Z" } } } - conversation.disqualifiedNot a fit in SetupThe contact was closed as not a fit:
qualificationisdisqualified,outcomeis alwaysclosed_no_result, anddisqualification_reasonsays why. Sent whoever decided it: the AI, by one of the campaign's reasons or your reasons for every campaign (Not interested, Not ready yet and Bad contact info among them); a person on your team; or SparkOps itself, with one of its own reasons: Unresponsive (they didn't reply to any of the follow-ups), Landline (Twilio says their number is a landline that has never texted you) or Closed for Message Delivery Error (texts to their number can't be delivered). Also sent when a contact who reached a result, or was closed with no result, is later found not a fit, and again when a person changes the reason.An example
conversation.disqualified{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "conversation.disqualified", "created_at": "2026-09-29T17:06:30.500Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "ended", "qualification": "disqualified", "outcome": "closed_no_result", "disqualification_reason": "Outside our service area", "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "Disqualified · Outside our service area\n\nWhat's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": "2026-09-29T17:04:12.345Z" } } } - contact.opted_outOpted out in SetupThe person opted out, however they said it, once until they opt back in. Adds
data.opt_out.An example
contact.opted_out{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "contact.opted_out", "created_at": "2026-09-29T17:07:12.771Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": true }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "ended", "qualification": null, "outcome": "opted_out", "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "Opted out\n\nWhat's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": "2026-09-29T17:04:12.345Z" }, "opt_out": { "how": "keyword", "at": "2026-09-29T17:07:12.771Z" } } } - spark_transfer.ringingSparkTransfer ringing in SetupSparkOps is putting a contact through to your call center, and its line starts to ring: they asked for a call by text, SparkOps called them, and they pressed 1 or said yes. Sent once a call, as it rings, so your CRM can show who's calling, with what they told us in
conversation. A test call from a campaign's SparkTransfer tab sends nothing. Only for a business SparkOps has turned SparkTransfer on for. Addsdata.spark_transfer.An example
spark_transfer.ringing{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "spark_transfer.ringing", "created_at": "2026-09-29T17:04:31.200Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "engaging", "qualification": null, "outcome": null, "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "What's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": null }, "spark_transfer": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a501", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "called_number": "+15125550199", "transfer_number": "+18585550199", "shown_number": "+18585550100", "response": "pressed_1", "result": null, "ended_at": null, "legs": [ { "leg": 1, "status": "in-progress", "rang_at": "2026-09-29T17:04:12.000Z", "answered_at": "2026-09-29T17:04:15.000Z", "ended_at": null, "seconds": null, "ended_by": null }, { "leg": 2, "status": "ringing", "rang_at": "2026-09-29T17:04:31.000Z", "answered_at": null, "ended_at": null, "seconds": null, "ended_by": null } ] } } } - spark_transfer.endedSparkTransfer ended in SetupA SparkTransfer call ended.
spark_transfer.resultsays how:spark_transfer(your call center's line answered),under_minimum(connected for less than the campaign's minimum),center_no_answer,hung_up_waiting(they hung up before your center answered),no_press(they didn't press 1 or say yes),declined(they said no),machine,no_answerorfailed. Each leg gives its moments, its connectedsecondsand who hung up (contact,center,sparkopsorunknown). Sent once a call; a test call sends nothing. Aspark_transferresult also sendsconversation.qualified. Addsdata.spark_transfer.An example
spark_transfer.ended{ "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001", "type": "spark_transfer.ended", "created_at": "2026-09-29T17:09:02.000Z", "business": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001", "name": "Coastal Comfort Heating & Air" }, "data": { "contact": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001", "phone": "+15125550199", "first_name": "Jordan", "last_name": "Reyes", "email": "jordan@example.com", "crm_id": "HS-1042", "metadata": { "unit_age": "12 years" }, "opted_out": false }, "conversation": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "created_via": "api", "source": "Google", "entry": "inquiry", "held_by": "ai", "person": null, "open": false, "state": "ended", "qualification": "qualified", "outcome": "spark_transfer", "disqualification_reason": null, "appointment": null, "answers": { "system_issue": "The upstairs unit blows warm air in the afternoons", "unit_age": "About 12 years" }, "additional_info": { "Home age": "Built 1994" }, "summary": "Qualified · SparkTransfer\n\nWhat's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994", "started_at": "2026-09-29T16:58:03.120Z", "ended_at": "2026-09-29T17:09:02.000Z" }, "spark_transfer": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a501", "campaign": { "id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001", "name": "New website inquiries" }, "called_number": "+15125550199", "transfer_number": "+18585550199", "shown_number": "+18585550100", "response": "pressed_1", "result": "spark_transfer", "ended_at": "2026-09-29T17:09:02.000Z", "legs": [ { "leg": 1, "status": "completed", "rang_at": "2026-09-29T17:04:12.000Z", "answered_at": "2026-09-29T17:04:15.000Z", "ended_at": "2026-09-29T17:09:02.000Z", "seconds": 287, "ended_by": "contact" }, { "leg": 2, "status": "completed", "rang_at": "2026-09-29T17:04:31.000Z", "answered_at": "2026-09-29T17:04:37.000Z", "ended_at": "2026-09-29T17:09:02.000Z", "seconds": 265, "ended_by": "contact" } ] } } } - testSent by "Send a test event" in Setup. Its
datais{ "test": true }.
What each carries
Every event has an id (the same on every retry), a type, created_at, the business, and data: the contact and, for a conversation's events, the conversation as it stood when the event happened. The body is kept, so every retry sends the same bytes.
conversation.held_byisai,person(thenpersonis their name) orunassigned(with your team, nobody on it yet), the same words the API's answers use.conversation.appointmentis the conversation's appointment, ornullwhen it has none. Itskindissoftfor a time the contact picked that isn't booked in a calendar (adayandtimein their time zone, or apart_of_day), orhardfor one the AI booked in your calendar. Its fields are listed below.conversation.answersis what the contact answered, each of the campaign's questions by its Saves as name:{ "unit_age": "About 12 years" }, in the campaign's order, so each is a field you can map into your own. A question the campaign skipped for them is left out, and so is one published before it had a name (it's still in the summary).conversation.additional_infois what else the AI kept from what they said, by the label the AI gave it, which can differ from one conversation to the next.conversation.summaryis all of it in one plain text, for a single field: the outcome, a booked time, each question asked with the answer on the next line, and what else they mentioned. The two objects are{}and the summary empty until there's something in them.conversation.activityaddsdata.message:direction(inboundoroutbound),body,author(contact,ai,personorsparkops),statusandat.conversation.calladdsdata.call, a call that's over: its fields are listed below. Theconversationbeside it holds what the call learned.contact.opted_outaddsdata.opt_out:how(keyword,their_words,apiorperson) andat.
What an appointment carries
- kind
softfor a time the contact picked that isn't booked in a calendar (a time to call them, say);hardfor an appointment the AI booked in your calendar. - statusFor a
hardappointment, what the calendar says of it:booked,pendingwhen the calendar took the request and it isn't final yet, orcancelledwhen the contact cancelled it by text or it was cancelled in the calendar (the outcome staysappointment_booked). A moved appointment is its new time,booked.nullfor asoftone. - wordsThe time as your team reads it in SparkOps: for a
softappointment the time the contact gave, in words ("Thursday, October 1, 3pm"), for ahardone the booked time ("Thu Oct 1, 3:00pm CT"). - dayThe day, in
time_zone.nullwhen asoftappointment names no day. - timeThe time of day, in
time_zone, on a 24-hour clock (15:00).nullwhen asoftappointment names no time. - part_of_day
morning,afternoonorevening, when asoftappointment names one in place of a time. Otherwisenull, and alwaysnullfor ahardone. - starts_atThe moment it starts, when both the day and the time are known. Always set for a
hardappointment. - ends_atThe moment a
hardappointment ends, when the calendar says.nullfor asoftone. - time_zoneThe time zone
day,timeandwordsare in, by its IANA name (America/Chicago). - meeting_typeThe name of the meeting type a
hardappointment was booked as, the one the campaign books on ("Estimate visit").nullfor asoftone. - providerThe calendar a
hardappointment was booked in, by name ("Calendly").nullfor asoftone. Where SparkOps is no longer set up for that calendar, its id, in lower case ("calendly").
What a call's event carries
- idThe call's id in SparkOps.
- direction
inboundwhen the contact called you,outboundfor a call placed to them. - answered_by
ai(the AI answered it, or SparkOps placed it for the AI and the contact answered),person(someone on your team answered it, or placed it and the contact answered) ornobody(the two sides never spoke). A call the AI picked up that failed before anything was said isnobodytoo: the caller heard only that the line had trouble. - personThe teammate's name when one answered or placed the call, else
null. A call a teammate placed names them even when the contact didn't answer. - status
completedwhen the two sides spoke, elsemissed: it rang and nobody answered, nobody could take it, only a recorded line answered, the AI's line had trouble before anything was said, or the contact didn't answer a call placed to them. A call SparkOps placed for the AI that their voicemail picked up ismissedtoo, answered bynobody. - duration_secondsHow long the call lasted, in seconds; for a call a teammate answered, the time they talked.
0for a missed call. - started_atWhen the call started.
- ended_atWhen it ended.
- transcriptWhat was said on a call the AI took, as one plain text: a line for each thing said,
Contact: ...orAssistant: .... At most 10,000 characters: a longer one stops at a line's end, then[cut short]on a line of its own. Empty ("") for a call with a teammate and for a missed call. The recording is never sent, nor a link to one.
Why a conversation needs your team
- new_inquirySomeone new texted your number.
- asked_for_personThey asked for a person.
- takeover_ruleOne of the campaign's takeover rules fired.
- guardrailA guardrail says a person handles this.
- rules_conflictTwo of your rules disagreed, so the AI handed it to a person.
- conditionAn answer met a question's hand-over condition.
- reply_blockedThe AI's reply broke a guardrail twice, so nothing was sent.
- no_usable_answerThe AI couldn't write a usable answer.
- cant_bookThe AI couldn't book the appointment: no open times, the contact didn't give what the booking needs or turned down the times offered, or the calendar couldn't be asked or didn't confirm it.
- cant_changeThe AI couldn't change the appointment: the contact asked to cancel or move it, and the calendar couldn't do it, didn't confirm it, or, after a move, couldn't cancel the old time. The appointment stands as the calendar holds it.
{
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001",
"type": "conversation.qualified",
"created_at": "2026-09-29T17:04:12.345Z",
"business": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001",
"name": "Coastal Comfort Heating & Air"
},
"data": {
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"phone": "+15125550199",
"first_name": "Jordan",
"last_name": "Reyes",
"email": "jordan@example.com",
"crm_id": "HS-1042",
"metadata": {
"unit_age": "12 years"
},
"opted_out": false
},
"conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"campaign": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"name": "New website inquiries"
},
"created_via": "api",
"source": "Google",
"entry": "inquiry",
"held_by": "ai",
"person": null,
"open": false,
"state": "ended",
"qualification": "qualified",
"outcome": "appointment_soft",
"disqualification_reason": null,
"appointment": {
"kind": "soft",
"status": null,
"words": "Thursday, October 1, 3pm",
"day": "2026-10-01",
"time": "15:00",
"part_of_day": null,
"starts_at": "2026-10-01T20:00:00.000Z",
"ends_at": null,
"time_zone": "America/Chicago",
"meeting_type": null,
"provider": null
},
"answers": {
"system_issue": "The upstairs unit blows warm air in the afternoons",
"unit_age": "About 12 years"
},
"additional_info": {
"Home age": "Built 1994"
},
"summary": "Qualified · Soft appointment\nAppointment: Thursday, October 1, 3pm\n\nWhat's going on with your system?\nThe upstairs unit blows warm air in the afternoons\n\nHow old is the system?\nAbout 12 years\n\nAlso mentioned\nHome age: Built 1994",
"started_at": "2026-09-29T16:58:03.120Z",
"ended_at": "2026-09-29T17:04:12.345Z"
}
}
}{
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000e001",
"type": "conversation.activity",
"created_at": "2026-09-29T17:03:40.020Z",
"business": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000f001",
"name": "Coastal Comfort Heating & Air"
},
"data": {
"contact": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000b001",
"phone": "+15125550199",
"first_name": "Jordan",
"last_name": "Reyes",
"email": "jordan@example.com",
"crm_id": "HS-1042",
"metadata": {
"unit_age": "12 years"
},
"opted_out": false
},
"conversation": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000a001",
"campaign": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000c001",
"name": "New website inquiries"
},
"created_via": "api",
"source": "Google",
"entry": "inquiry",
"held_by": "ai",
"person": null,
"open": false,
"state": "engaging",
"qualification": null,
"outcome": null,
"disqualification_reason": null,
"appointment": null,
"answers": {
"system_issue": "The upstairs unit blows warm air in the afternoons"
},
"additional_info": {},
"summary": "What's going on with your system?\nThe upstairs unit blows warm air in the afternoons",
"started_at": "2026-09-29T16:58:03.120Z",
"ended_at": null
},
"message": {
"id": "3b6f1d2e-8c4a-4f7e-9a1b-00000000d001",
"direction": "inbound",
"body": "Thursday at 3 works",
"author": "contact",
"person": null,
"status": "delivered",
"at": "2026-09-29T17:03:39.870Z"
}
}
}{
"kind": "hard",
"status": "booked",
"words": "Thu Oct 1, 3:00pm CT",
"day": "2026-10-01",
"time": "15:00",
"part_of_day": null,
"starts_at": "2026-10-01T20:00:00.000Z",
"ends_at": "2026-10-01T21:00:00.000Z",
"time_zone": "America/Chicago",
"meeting_type": "Estimate visit",
"provider": "Calendly"
}Checking a signature
SparkOps signs every delivery as Standard Webhooks does, so any of its libraries checks it with your endpoint's secret. Three headers come with each delivery:
webhook-id: the event's id, the same on every retry. Use it to ignore a repeat.webhook-timestamp: this attempt's time, in seconds. Refuse one more than five minutes from now.webhook-signature:v1,and the base64 HMAC-SHA256 of<webhook-id>.<webhook-timestamp>.<body>, keyed with the secret afterwhsec_, base64-decoded.
Check the body exactly as it arrived, before parsing it.
import { createHmac, timingSafeEqual } from "node:crypto";
// secret: the endpoint's signing secret, "whsec_..." (Setup › API shows it once).
// headers: a plain object or a Fetch Headers; rawBody: the body exactly as it arrived (a string or a Buffer).
export function verifyWebhook(secret, headers, rawBody) {
const get = (name) => (typeof headers.get === "function" ? headers.get(name) : headers[name]) ?? "";
const id = get("webhook-id");
const timestamp = get("webhook-timestamp");
// Refuse a delivery more than five minutes from now: an old one replayed.
if (!id || !/^[0-9]+$/.test(timestamp) || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const digest = createHmac("sha256", key).update(`${id}.${timestamp}.`).update(rawBody).digest("base64");
const expected = Buffer.from("v1," + digest);
return get("webhook-signature").split(" ").some((signature) => {
const given = Buffer.from(signature);
return given.length === expected.length && timingSafeEqual(given, expected);
});
}import base64
import hashlib
import hmac
import time
# secret: the endpoint's signing secret, "whsec_..." (Setup › API shows it once).
# raw_body: the body exactly as it arrived, as bytes (Flask's request.get_data(), Django's request.body,
# FastAPI's await request.body()) or a string.
def verify_webhook(secret, headers, raw_body):
msg_id = headers.get("webhook-id")
timestamp = headers.get("webhook-timestamp", "")
signatures = headers.get("webhook-signature", "")
# Refuse a delivery more than five minutes from now: an old one replayed.
if not msg_id or not timestamp.isdigit() or abs(time.time() - int(timestamp)) > 300:
return False
body = raw_body if isinstance(raw_body, bytes) else raw_body.encode()
key = base64.b64decode(secret[len("whsec_"):])
digest = hmac.new(key, f"{msg_id}.{timestamp}.".encode() + body, hashlib.sha256).digest()
expected = "v1," + base64.b64encode(digest).decode()
return any(hmac.compare_digest(s, expected) for s in signatures.split(" "))Delivery and retries
- Answer with any
2xxwithin 10 seconds and the event is delivered. Do slow work after you answer. - Anything else (another status, no answer in time, no connection) is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 10 hours: 8 attempts over about 28 hours. Then it has failed.
- Answer
410 Goneand SparkOps turns the endpoint off, and drops what else waits for it. - Events can arrive more than once, and out of order: ignore an
idyou've seen, and usecreated_atfor the order. - Redirects aren't followed. Setup › API shows each endpoint's last delivery, and the latest 20.
Versions and changes
Requests live under /api/v1. Within v1, SparkOps may add fields to answers and events, add events, add error codes, and add new values to a field's list, without notice: read what you know and ignore the rest. Anything that would break a working request comes as a new version. The API as OpenAPI 3.1 is here for Postman and code generators.
- 2026-11-24One-time text campaigns: a campaign that sends one text, such as a confirmation or a reminder, and asks nothing. Start a contact on one as on any campaign. Its conversation ends the moment it starts, so the contact is free for any other campaign at once, and
conversation.outcomeis a new value,one_time_text_sent, in the start's answer and in every webhook about that conversation. It is never a result: noconversation.qualifiedorconversation.disqualifiedis sent for it. A reply still sendsconversation.activity. The API's requests are unchanged. - 2026-11-24A contact with an appointment the AI booked can cancel it or move it to another time by text.
conversation.needs_attentionhas a newreason,cant_change: the AI couldn't change the appointment (the calendar couldn't cancel or move it, didn't confirm it, or after a move couldn't cancel the old time), so a person sees to it, and the appointment stands as the calendar holds it. It can come for a conversation a teammate already holds, as a booking's can (held_by: "person").conversation.appointment.statuscan now readcancelled: the appointment was cancelled by text or in the calendar, and the outcome staysappointment_booked. A moved appointment is its new time. No event is sent for a move or a cancel: your endpoint sees the appointment as it stands on the conversation's next event. The API's requests are unchanged. - 2026-11-24When a contact asks to be called back, SparkOps can now call them with the AI at the time they asked for (or at once, when they say now). Each of these calls sends
conversation.callwhen it ends, as every call does:directionoutbound,answered_byaiwith the call'stranscriptwhen they answered, ornobodyandstatusmissedwhen they didn't or their voicemail picked up. No field or event is new, and the API's requests are unchanged. - 2026-11-23For a campaign that books on a connected calendar, the AI can book the appointment itself.
conversation.appointment, in every webhook about a conversation, has a secondkind,hard, for an appointment booked that way (softis as before), and four new fields:status(bookedorpending),ends_at,meeting_typeandprovider, the calendar's name. A soft appointment carries the four asnull, and its other fields are as they were.conversation.summarysays a hard appointment's time on its Appointment line for as long as the booking stands, whatever the outcome, with its meeting type in brackets, and adds "requested, not confirmed yet" while the calendar hasn't confirmed it.conversation.qualifiedwithoutcome: "appointment_booked"is sent once the calendar confirms a booking.conversation.needs_attentionhas a newreason,cant_book: the AI couldn't book the appointment, so a person does. It can now also come for a conversation a teammate already holds (held_by: "person"), when a booking the AI started finishes after they took it: filter onheld_byif you only want conversations nobody holds. The API's requests are unchanged. - 2026-11-22A new event,
conversation.call, for every call with a contact, sent once when the call is over: one the AI answered, one that rang your team, one your team placed, or a missed one. Itsdata.callsays which way the call went, who answered, how long it lasted, when, and for a call the AI took what was said, as one plain text. No endpoint you have starts receiving it: add an endpoint with Call ticked.conversation.activityis unchanged, and a SparkTransfer call keeps its own two events. - 2026-11-13Each answer in
conversation.answers, and each value inconversation.additional_info, is now a short, tidy value, the way a field holds it: "California" whether the contact wrote "I'm in California" or "Cali", "Local" for "Local would be great".conversation.summaryreads the same values. The shape is unchanged, and answers recorded before stay as they were. - 2026-11-09For businesses with SparkTransfer: two new events,
spark_transfer.ringingas your call center's line starts to ring andspark_transfer.endedwith what came of the call, each with aspark_transferobject (a test call sends neither); andspark_transferis a fifthresultonconversation.qualified. Nothing else changed. - 2026-11-07What the contact told us is easier to map:
conversation.answersis now an object of each answered question's Saves as name to its answer ("unit_age": "About 12 years"),conversation.additional_infoan object of what else the AI kept, by its label (it wasdetails), and the newconversation.summaryis all of it, with the outcome and a booked time, in one plain text for a single field. Each answer'squestion_id,question,fieldandatare gone, and so isdetails. - 2026-11-03Every webhook about a conversation carries what the contact told us:
conversation.answers, each of the campaign's questions they answered (withfield, the name its answer saves as), andconversation.details, what else the AI kept. Both are lists, empty until there's something in them; nothing else changed. - 2026-10-29A new reason for every business, "Not ready yet": a contact who says they aren't ready yet for what the campaign offers is closed with it, and
conversation.disqualifiedcarries it asdisqualification_reason. In a campaign that aims for Information gathered,conversation.qualifiednow comes once every question has an answer, the optional ones included, or once the contact turns one down. - 2026-10-29A contact who doesn't reply to any of the follow-ups is now closed Disqualified · Unresponsive, and
conversation.disqualifiedis sent (before, "Closed, no result" with no webhook). - 2026-10-22A request naming an archived campaign is refused with
campaign_archived(409). - 2026-10-04Start a campaign's answer says how the conversation stands:
qualification,outcomeanddisqualification_reason, as the webhooks do. A lead whose number Twilio calls a landline, who has never texted you, is recorded and closed as Disqualified · Landline, withopening.status: "not_sent"andreason: "landline"; nothing is sent, and the same request again returns it. - 2026-10-02A request with no
Idempotency-Key, keyed by its body, returns the conversation it made only while that conversation hasn't ended; after that, the same body starts a new one. Your ownIdempotency-Keystill holds for 24 hours. - 2026-09-30
conversation.qualifiedis sent with a result, each time one is recorded, and carries it;conversation.result_reachedis gone (an endpoint that asked for it now getsconversation.qualified). - 2026-09-30An owner or manager can show a key again in Setup › API (keys made from now on); each time is recorded.
- 2026-09-30
crm_idis a standard field: sent with a lead, returned in answers and webhooks, and able to end a campaign or opt someone out. - 2026-09-30
sourceis your own channel for a lead ("Google"); how SparkOps made a conversation is nowcreated_via(api,app,inbound_text, and more). - 2026-09-30A lead sent without
entryis an inquiry (before, outreach);inquired_atis gone (put it inmetadataif you need it). - 2026-09-29Webhooks say
held_by: "unassigned"for a conversation nobody has picked up, as the API's answers do (before,team). - 2026-09-29Webhooks: six events, signed, retried for about a day and a quarter.
- 2026-09-28API v1: start a campaign, end a campaign, opt someone out; keys in Setup › API.