/v1/management/campaignsReview one recipient and preserve one send intent
For a document, first confirm that it is ready for the intended customer. A staff-created appointment must already be CONFIRMED and still match the reviewed booking. Approval of a PENDING customer request uses CRAD’s automatic confirmation instead of this separate send.
Preview one real CRAD profile, require exactly that recipient and no skipped recipients, and show the rendered message before explicit staff confirmation. Before POST /campaigns, persist the exact draft, quoted cp ETag and one send UUID in an outbox event unique to that send intent. An initial staff-booking confirmation is unique per clinic, purpose and appointment; a document send also includes its explicit sendIntentId.
A later deliberate Send again for a document, after the previous outcome is known, creates a new sendIntentId and UUID after reviewing the saved report version and recipient. sendIntentId belongs to your outbox, not the CRAD request body. Concurrent clicks and retries of the same action keep the original intent and UUID. A queued, timed-out, not_found or unknown result is not a reason to create a new intent.
On timeout use /campaign-operations/{savedUuid}. not_found does not cancel an in-flight request: recover or explicitly retry the same UUID/body/ETag, never invent a new send UUID or automatically resend an unknown outcome. Track /campaigns/{campaignId}/recipients; sent means provider acceptance, not delivery. A suppressed or failed message does not undo the saved appointment or document.
Permissions for this step
campaigns:readcampaigns:send
Continue with the clinic notification workflow
Request illustration — construct it for your backend; this is not a recorded HTTP exchange. post() uses the Management base and returns {data, etag}. Keep the key on your server.
const draft = {
providerId: null, audience: { kind: "contacts" },
recipientProfileIds: [cradProfileId],
template: { name: approvedName, language: approvedLanguage },
parameters: [authenticatedPortalEntryUrl],
matchLanguage: false, externalActorRef: documentReadyEventRef
};
const preview = await post("/campaign-previews", draft);
if (preview.data.recipientCount !== 1 || preview.data.recipients.length !== 1 ||
preview.data.recipients[0].profileId.toLowerCase() !== cradProfileId.toLowerCase() ||
preview.data.skipped.length !== 0 || !/^"cp[0-9a-f]{64}"$/.test(preview.etag ?? "")) {
throw new Error("Review the intended recipient and preview");
}
// Require a ready document, its notice permission and explicit staff approval.
// Persist one outbox event with this exact draft, ETag and savedSendUuid first.
await post("/campaigns", { draft, confirm: true }, {
"If-Match": preview.etag, "Idempotency-Key": savedSendUuid
});
// On timeout recover /campaign-operations/{savedSendUuid}; do not invent a new UUID. Behavior
Submit confirm:true with the exact reviewed draft and its cp ETag. Acceptance creates one durable campaign and queues the existing sender; it does not prove delivery. A changed preview returns 412 without accepting a replacement campaign. Current permission, connection, consent and capacity checks still apply. Use the Campaigns workflow error-code table to distinguish an existing operation, another open campaign, no recipients and exhausted capacity; do not infer the next action from HTTP 409 alone.
Authentication
ManagementCredential
Credential rules
One server-only owner-issued wbm_ API key can carry both management and integration permissions. Additional permissions require an explicit owner-issued grant. GET /v1/management returns the management discovery view, which may be empty for a booking-only key. For credentials with appointments:read, this discovery view omits whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write to preserve calendar-client compatibility. Discover these grants through GET /v1/management/messaging-capabilities. Template/profile command authorization still uses the stored grants. Server-only owner-issued Management authority with explicit application permissions. Calling this API does not expand a credential's grants. contacts:read/write/block/sync/fields:read/fields:write are separate approvals for canonical business contacts; fields also require current typed owner grants. contacts:record remains contact recording/recovery only. These grants create no customer phone proof, booking authority, messaging consent or automatic synchronization. Hours/blocks retain their independent resource grants. booking-policy:read/write separately delegate whole-business booking settings, without schedule/provider grants; write requires read. They preserve existing appointments and create no duration-rewrite authority. Provider duration policy additionally requires explicit provider-booking-policy:read/write and exact current providerIds; booking-duration:rewrite is separately approved and does not itself grant policy read/write. Service catalogue requires explicit services:read/write, independent of provider/calendar/schedule resources; write requires read. These operations do not expand an existing credential's grants. Public presentation and reviewed service selection require explicit website-content:read/write; write requires read, independently from services:* and provider resources. Existing provider metadata/activity/assignment additionally requires providers:read/write and a nonempty explicit current providerIds grant; write requires read. This grants no provider creation, deletion, login, invitation or schedule authority. WhatsApp template/profile management requires separate whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write application scopes. Write requires its matching read scope. These grants require explicit owner approval; Meta OAuth permissions remain separate.
Required application permissions
campaigns:readcampaigns:send
An owner must separately grant campaign access to the whole business or selected active providers. Calendar and customer grants do not imply campaign access. A provider-scoped campaign uses one granted provider and appointment customers. Keep this Management key on your backend.
Request
Idempotency and recovery
Persist one operation UUID, the original If-Match and exact body before submitting. After uncertainty, GET campaign-operations/{operationId}. This check never sends. An explicit retry keeps the original UUID, version and body; not_found does not rule out an earlier request still committing.
Idempotency-Keyheader · stringRequiredPersist one UUID together with the exact request before dispatch. Use the original UUID for recovery or explicit exact retry.
Format and constraints
{ "type": "string", "format": "uuid" }If-Matchheader · stringRequiredQuoted ETag returned by the exact reviewed preview.
Format and constraints
{ "type": "string", "pattern": "^\"cp[a-f0-9]{64}\"$" }
Request body · required
application/json · BusinessCampaignCreate
-
draftobjectRequiredView nested fields
-
providerIdanyOf (string | null)OptionalAt least one of these variants must match.
View nested fields
-
anyOf 1string · uuidSchema branch -
anyOf 2nullSchema branch
-
-
templateobjectRequiredView nested fields
-
namestringRequiredpattern:"^[a-z0-9_]{1,512}$" -
languagestringRequiredpattern:"^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$" -
additionalPropertiesno value allowedSchema rule
-
-
parametersarrayRequiredmaxItems:1000View nested fields
-
[]stringArray itemTrimmed, nonempty. No tab/newline or five consecutive spaces. Lengths use JavaScript UTF-16 units; rendered body is at most 1,024 units.
maxLength:200minLength:1
-
-
matchLanguagebooleanRequired -
audienceoneOf (object | object | object)RequiredExactly one of these variants must match.
View nested fields
-
oneOf 1 · kind = "contacts"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"contacts" -
additionalPropertiesno value allowedSchema rule
-
-
oneOf 2 · kind = "appointments"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"appointments" -
fromstring · date-timeRequired in this branch -
tostring · date-timeRequired in this branch -
statusesarrayOptional in this branchDefaults to PENDING, CONFIRMED and NOW. Instants must satisfy from < to.
maxItems:3minItems:1View nested fields
-
[]stringArray itemAllowed values:
["PENDING","CONFIRMED","NOW"]
-
-
additionalPropertiesno value allowedSchema rule
-
-
oneOf 3 · kind = "segment"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"segment" -
filtersobjectRequired in this branchdependentRequired:{"visitedFrom":["visitedTo"],"visitedTo":["visitedFrom"]}View nested fields
-
awaystringOptional in this branchAllowed values:
["3w","1m","2m","3m"] -
visitsstringOptional in this branchAllowed values:
["none","one","recentRegular","regular"] -
backToBackstringOptional in this branchAllowed values:
["once","repeated"] -
lateRegularbooleanOptional in this branchValue:
true -
noUpcomingbooleanOptional in this branchValue:
true -
recentMissedbooleanOptional in this branchValue:
true -
newCustomersbooleanOptional in this branchValue:
true -
languagestringOptional in this branchAllowed values:
["he","ar","en"] -
notSentBeforebooleanOptional in this branchValue:
true -
lastVisitstringOptional in this branchAllowed values:
["within30","notSince60","notSince90"] -
overduebooleanOptional in this branchValue:
true -
missedbooleanOptional in this branchValue:
true -
providerIdstring · uuidOptional in this branch -
visitedFromstring · dateOptional in this branch -
visitedTostring · dateOptional in this branch -
additionalPropertiesno value allowedSchema rule
-
-
providerNameanyOf (string | null)Optional in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchAt most 160 JavaScript UTF-16 units in the submitted value and 80 Unicode codepoints after trimming. Blank becomes null.
maxLength:160pattern:"^\\s*[\\s\\S]{0,80}\\s*$" -
anyOf 2nullSchema branch
-
-
additionalPropertiesno value allowedSchema rule
-
-
-
recipientProfileIdsarrayRequiredExplicit selected contact profile IDs, in reviewed order. Repeated IDs are removed preserving first occurrence; one recipient per normalized number. At most 300 eligible recipients.
maxItems:1000minItems:1View nested fields
-
[]string · uuidArray item
-
-
externalActorRefanyOf (string | null)OptionalAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchOptional nonblank external audit reference. At most 200 JavaScript UTF-16 units; original spacing is retained. This never grants identity or authority.
maxLength:200minLength:1pattern:"^(?=[\\s\\S]*\\S)[^\\u0000-\\u001f\\u007f]+$" -
anyOf 2nullSchema branch
-
-
additionalPropertiesno value allowedSchema rule
-
-
confirmbooleanRequiredValue:
true -
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"draft": {
"type": "object",
"additionalProperties": false,
"properties": {
"providerId": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
]
},
"template": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z0-9_]{1,512}$"
},
"language": {
"type": "string",
"pattern": "^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$"
}
},
"required": [
"name",
"language"
]
},
"parameters": {
"type": "array",
"items": {
"type": "string",
"maxLength": 200,
"minLength": 1,
"description": "Trimmed, nonempty. No tab/newline or five consecutive spaces. Lengths use JavaScript UTF-16 units; rendered body is at most 1,024 units."
},
"maxItems": 1000
},
"matchLanguage": {
"type": "boolean"
},
"audience": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "contacts"
}
},
"required": [
"kind"
]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "appointments"
},
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
},
"statuses": {
"type": "array",
"items": {
"type": "string",
"enum": [
"PENDING",
"CONFIRMED",
"NOW"
]
},
"maxItems": 3,
"minItems": 1,
"description": "Defaults to PENDING, CONFIRMED and NOW. Instants must satisfy from < to."
}
},
"required": [
"kind",
"from",
"to"
]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "segment"
},
"filters": {
"type": "object",
"additionalProperties": false,
"properties": {
"away": {
"type": "string",
"enum": [
"3w",
"1m",
"2m",
"3m"
]
},
"visits": {
"type": "string",
"enum": [
"none",
"one",
"recentRegular",
"regular"
]
},
"backToBack": {
"type": "string",
"enum": [
"once",
"repeated"
]
},
"lateRegular": {
"const": true
},
"noUpcoming": {
"const": true
},
"recentMissed": {
"const": true
},
"newCustomers": {
"const": true
},
"language": {
"type": "string",
"enum": [
"he",
"ar",
"en"
]
},
"notSentBefore": {
"const": true
},
"lastVisit": {
"type": "string",
"enum": [
"within30",
"notSince60",
"notSince90"
]
},
"overdue": {
"const": true
},
"missed": {
"const": true
},
"providerId": {
"type": "string",
"format": "uuid"
},
"visitedFrom": {
"type": "string",
"format": "date"
},
"visitedTo": {
"type": "string",
"format": "date"
}
},
"required": [],
"dependentRequired": {
"visitedFrom": [
"visitedTo"
],
"visitedTo": [
"visitedFrom"
]
}
},
"providerName": {
"anyOf": [
{
"type": "string",
"maxLength": 160,
"pattern": "^\\s*[\\s\\S]{0,80}\\s*$",
"description": "At most 160 JavaScript UTF-16 units in the submitted value and 80 Unicode codepoints after trimming. Blank becomes null."
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"filters"
]
}
]
},
"recipientProfileIds": {
"type": "array",
"items": {
"type": "string",
"format": "uuid"
},
"maxItems": 1000,
"minItems": 1,
"description": "Explicit selected contact profile IDs, in reviewed order. Repeated IDs are removed preserving first occurrence; one recipient per normalized number. At most 300 eligible recipients."
},
"externalActorRef": {
"anyOf": [
{
"type": "string",
"maxLength": 200,
"minLength": 1,
"pattern": "^(?=[\\s\\S]*\\S)[^\\u0000-\\u001f\\u007f]+$",
"description": "Optional nonblank external audit reference. At most 200 JavaScript UTF-16 units; original spacing is retained. This never grants identity or authority."
},
{
"type": "null"
}
]
}
},
"required": [
"template",
"parameters",
"matchLanguage",
"audience",
"recipientProfileIds"
]
},
"confirm": {
"const": true
}
},
"required": [
"draft",
"confirm"
]
} Successful responses
200 · BusinessCampaignResult
Accepted intent and current state; not a delivery guarantee.
Cache-Control
{
"const": "no-store"
} ETag · Strong current version. Keep the original If-Match with an uncertain command; only a new deliberate command uses a fresh current version.
{
"type": "string",
"pattern": "^\"cc(0|[1-9][0-9]*)\"$"
} application/json · BusinessCampaignResult
Immutable accepted intent receipt plus current authorized state, which may be newer or unavailable. A successful create/continue/retry queues accepted work for the existing bounded sender; it does not prove recipient delivery. Exact replay never creates another campaign or repeats a control mutation.
All of these schema rules apply together.
-
receiptobject; allOf (unspecified)RequiredAll of these schema rules apply together.
View nested fields
-
operationIdstring · uuidRequired -
actionstringRequiredAllowed values:
["create","continue","retry","stop"] -
campaignIdstring · uuidRequired -
requestHashstringRequiredpattern:"^[a-f0-9]{64}$" -
expectedVersionanyOf (integer | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1integerSchema branchminimum:0maximum:9007199254740991 -
anyOf 2nullSchema branch
-
-
previewVersionanyOf (string | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchpattern:"^cp[a-f0-9]{64}$" -
anyOf 2nullSchema branch
-
-
externalActorRefanyOf (string | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchOptional nonblank external audit reference. At most 200 JavaScript UTF-16 units; original spacing is retained. This never grants identity or authority.
maxLength:200minLength:1pattern:"^(?=[\\s\\S]*\\S)[^\\u0000-\\u001f\\u007f]+$" -
anyOf 2nullSchema branch
-
-
resultobjectRequiredView nested fields
-
versionintegerRequiredminimum:0maximum:9007199254740991 -
affectedCountintegerRequiredminimum:0maximum:300 -
additionalPropertiesno value allowedSchema rule
-
-
allOf 1unspecifiedSchema branchView branch fields and rules
-
ifobjectSchema ruleView branch fields and rules
-
actionstringCondition predicateValue:
"create"
-
-
thenobjectSchema ruleView branch fields and rules
-
expectedVersionnullOptional in this branch -
previewVersionstringOptional in this branchpattern:"^cp[a-f0-9]{64}$"
-
-
elseobjectSchema ruleView branch fields and rules
-
expectedVersionintegerOptional in this branchminimum:0maximum:9007199254740991 -
previewVersionnullOptional in this branch
-
-
-
additionalPropertiesno value allowedSchema rule
-
-
currentanyOf (object; allOf (unspecified) | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1object; allOf (unspecified)Schema branchCurrent authorized campaign. version is the control revision, not a revision for every delivery update. Historical legacy_body campaigns retain body-only confirmation and continuation behavior; a snapshot is never fabricated for them. New campaigns use full_template. sent means provider acceptance, not proven delivery/read.
All of these schema rules apply together.
View branch fields and rules
-
campaignIdstring · uuidRequired in this branch -
providerIdanyOf (string | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1string · uuidSchema branch -
anyOf 2nullSchema branch
-
-
sourcestringRequired in this branchAllowed values:
["native","integration"] -
versionintegerRequired in this branchminimum:0maximum:9007199254740991 -
confirmationstringRequired in this branchAllowed values:
["legacy_body","full_template"] -
templateobjectRequired in this branchView nested fields
-
namestringRequired in this branchpattern:"^[a-z0-9_]{1,512}$" -
languagestringRequired in this branchpattern:"^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$" -
bodyanyOf (string | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchmaxLength:16384 -
anyOf 2nullSchema branch
-
-
parametersarrayRequired in this branchmaxItems:1000View nested fields
-
[]stringArray itemmaxLength:200
-
-
matchLanguagebooleanRequired in this branch -
snapshotanyOf (array | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1arraySchema branchmaxItems:4minItems:1View branch fields and rules
-
[]objectArray itemView nested fields
-
namestringRequired in this branchpattern:"^[a-z0-9_]{1,512}$" -
languagestringRequired in this branchpattern:"^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$" -
statusstringRequired in this branchValue:
"APPROVED" -
categorystringRequired in this branchmaxLength:50 -
componentsarrayRequired in this branchmaxItems:10View nested fields
-
[]objectArray itemView nested fields
-
typestringRequired in this branchmaxLength:50 -
formatstringOptional in this branchmaxLength:50 -
textstringOptional in this branchmaxLength:16384 -
buttonsarrayOptional in this branchmaxItems:10View nested fields
-
[]objectArray itemView nested fields
-
typestringRequired in this branchmaxLength:50 -
textstringOptional in this branchmaxLength:1024 -
urlstringOptional in this branchmaxLength:4096 -
phone_numberstringOptional in this branchmaxLength:64 -
additionalPropertiesno value allowedSchema rule
-
-
-
additionalPropertiesno value allowedSchema rule
-
-
-
bodystringRequired in this branchmaxLength:16384 -
placeholdersintegerRequired in this branchminimum:0maximum:1000 -
fingerprintstringRequired in this branchpattern:"^[a-f0-9]{64}$" -
bodyFingerprintstringRequired in this branchpattern:"^[a-f0-9]{64}$" -
additionalPropertiesno value allowedSchema rule
-
-
-
anyOf 2nullSchema branch
-
-
additionalPropertiesno value allowedSchema rule
-
-
audienceoneOf (object | object | object)Required in this branchExactly one of these variants must match.
View nested fields
-
oneOf 1 · kind = "contacts"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"contacts" -
additionalPropertiesno value allowedSchema rule
-
-
oneOf 2 · kind = "appointments"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"appointments" -
fromstring · date-timeRequired in this branch -
tostring · date-timeRequired in this branch -
statusesarrayOptional in this branchDefaults to PENDING, CONFIRMED and NOW. Instants must satisfy from < to.
maxItems:3minItems:1View nested fields
-
[]stringArray itemAllowed values:
["PENDING","CONFIRMED","NOW"]
-
-
additionalPropertiesno value allowedSchema rule
-
-
oneOf 3 · kind = "segment"objectSchema branchView branch fields and rules
-
kindstringRequired in this branchValue:
"segment" -
filtersobjectRequired in this branchdependentRequired:{"visitedFrom":["visitedTo"],"visitedTo":["visitedFrom"]}View nested fields
-
awaystringOptional in this branchAllowed values:
["3w","1m","2m","3m"] -
visitsstringOptional in this branchAllowed values:
["none","one","recentRegular","regular"] -
backToBackstringOptional in this branchAllowed values:
["once","repeated"] -
lateRegularbooleanOptional in this branchValue:
true -
noUpcomingbooleanOptional in this branchValue:
true -
recentMissedbooleanOptional in this branchValue:
true -
newCustomersbooleanOptional in this branchValue:
true -
languagestringOptional in this branchAllowed values:
["he","ar","en"] -
notSentBeforebooleanOptional in this branchValue:
true -
lastVisitstringOptional in this branchAllowed values:
["within30","notSince60","notSince90"] -
overduebooleanOptional in this branchValue:
true -
missedbooleanOptional in this branchValue:
true -
providerIdstring · uuidOptional in this branch -
visitedFromstring · dateOptional in this branch -
visitedTostring · dateOptional in this branch -
additionalPropertiesno value allowedSchema rule
-
-
providerNameanyOf (string | null)Optional in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchAt most 160 JavaScript UTF-16 units in the submitted value and 80 Unicode codepoints after trimming. Blank becomes null.
maxLength:160pattern:"^\\s*[\\s\\S]{0,80}\\s*$" -
anyOf 2nullSchema branch
-
-
additionalPropertiesno value allowedSchema rule
-
-
-
recipientCountintegerRequired in this branchminimum:0maximum:300 -
sentCountintegerRequired in this branchminimum:0maximum:300 -
failedCountintegerRequired in this branchminimum:0maximum:300 -
unknownCountintegerRequired in this branchminimum:0maximum:300 -
pendingCountintegerRequired in this branchminimum:0maximum:300 -
sendingCountintegerRequired in this branchminimum:0maximum:300 -
statestringRequired in this branchAllowed values:
["sending","done"] -
createdAtstring · date-timeRequired in this branch -
finishedAtanyOf (string | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1string · date-timeSchema branch -
anyOf 2nullSchema branch
-
-
stoppedAtanyOf (string | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1string · date-timeSchema branch -
anyOf 2nullSchema branch
-
-
pausedAtanyOf (string | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1string · date-timeSchema branch -
anyOf 2nullSchema branch
-
-
stopCodeanyOf (integer | null)Required in this branchAt least one of these variants must match.
View nested fields
-
anyOf 1integerSchema branchminimum:-9007199254740991maximum:9007199254740991 -
anyOf 2nullSchema branch
-
-
allOf 1unspecifiedSchema branchView branch fields and rules
-
ifobjectSchema ruleView branch fields and rules
-
confirmationstringCondition predicateValue:
"legacy_body"
-
-
thenobjectSchema ruleView branch fields and rules
-
templateobjectOptional in this branchView nested fields
-
snapshotnullOptional in this branch
-
-
-
elseobjectSchema ruleView branch fields and rules
-
templateobjectOptional in this branchView nested fields
-
snapshotarrayOptional in this branchminItems:1maxItems:4View nested fields
-
[]objectArray itemView nested fields
-
namestringRequired in this branchpattern:"^[a-z0-9_]{1,512}$" -
languagestringRequired in this branchpattern:"^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$" -
statusstringRequired in this branchValue:
"APPROVED" -
categorystringRequired in this branchmaxLength:50 -
componentsarrayRequired in this branchmaxItems:10View nested fields
-
[]objectArray itemView nested fields
-
typestringRequired in this branchmaxLength:50 -
formatstringOptional in this branchmaxLength:50 -
textstringOptional in this branchmaxLength:16384 -
buttonsarrayOptional in this branchmaxItems:10View nested fields
-
[]objectArray itemView nested fields
-
typestringRequired in this branchmaxLength:50 -
textstringOptional in this branchmaxLength:1024 -
urlstringOptional in this branchmaxLength:4096 -
phone_numberstringOptional in this branchmaxLength:64 -
additionalPropertiesno value allowedSchema rule
-
-
-
additionalPropertiesno value allowedSchema rule
-
-
-
bodystringRequired in this branchmaxLength:16384 -
placeholdersintegerRequired in this branchminimum:0maximum:1000 -
fingerprintstringRequired in this branchpattern:"^[a-f0-9]{64}$" -
bodyFingerprintstringRequired in this branchpattern:"^[a-f0-9]{64}$" -
additionalPropertiesno value allowedSchema rule
-
-
-
-
-
-
additionalPropertiesno value allowedSchema rule
-
-
anyOf 2nullSchema branch
-
-
currentUnavailableReasonanyOf (string | null)RequiredAt least one of these variants must match.
View nested fields
-
anyOf 1stringSchema branchValue:
"campaign_not_found" -
anyOf 2nullSchema branch
-
-
replayedbooleanRequired -
allOf 1unspecifiedSchema branchView branch fields and rules
-
ifobjectSchema ruleView branch fields and rules
-
currentnullCondition predicate
-
-
thenobjectSchema ruleView branch fields and rules
-
currentUnavailableReasonstringOptional in this branchValue:
"campaign_not_found"
-
-
elseobjectSchema ruleView branch fields and rules
-
currentUnavailableReasonnullOptional in this branch
-
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"receipt": {
"type": "object",
"additionalProperties": false,
"properties": {
"operationId": {
"type": "string",
"format": "uuid"
},
"action": {
"type": "string",
"enum": [
"create",
"continue",
"retry",
"stop"
]
},
"campaignId": {
"type": "string",
"format": "uuid"
},
"requestHash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"expectedVersion": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
},
"previewVersion": {
"anyOf": [
{
"type": "string",
"pattern": "^cp[a-f0-9]{64}$"
},
{
"type": "null"
}
]
},
"externalActorRef": {
"anyOf": [
{
"type": "string",
"maxLength": 200,
"minLength": 1,
"pattern": "^(?=[\\s\\S]*\\S)[^\\u0000-\\u001f\\u007f]+$",
"description": "Optional nonblank external audit reference. At most 200 JavaScript UTF-16 units; original spacing is retained. This never grants identity or authority."
},
{
"type": "null"
}
]
},
"result": {
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"affectedCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
}
},
"required": [
"version",
"affectedCount"
]
}
},
"required": [
"operationId",
"action",
"campaignId",
"requestHash",
"expectedVersion",
"previewVersion",
"externalActorRef",
"result"
],
"allOf": [
{
"if": {
"properties": {
"action": {
"const": "create"
}
}
},
"then": {
"properties": {
"expectedVersion": {
"type": "null"
},
"previewVersion": {
"type": "string",
"pattern": "^cp[a-f0-9]{64}$"
}
}
},
"else": {
"properties": {
"expectedVersion": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"previewVersion": {
"type": "null"
}
}
}
}
]
},
"current": {
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"campaignId": {
"type": "string",
"format": "uuid"
},
"providerId": {
"anyOf": [
{
"type": "string",
"format": "uuid"
},
{
"type": "null"
}
]
},
"source": {
"type": "string",
"enum": [
"native",
"integration"
]
},
"version": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"confirmation": {
"type": "string",
"enum": [
"legacy_body",
"full_template"
]
},
"template": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z0-9_]{1,512}$"
},
"language": {
"type": "string",
"pattern": "^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$"
},
"body": {
"anyOf": [
{
"type": "string",
"maxLength": 16384
},
{
"type": "null"
}
]
},
"parameters": {
"type": "array",
"items": {
"type": "string",
"maxLength": 200
},
"maxItems": 1000
},
"matchLanguage": {
"type": "boolean"
},
"snapshot": {
"anyOf": [
{
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z0-9_]{1,512}$"
},
"language": {
"type": "string",
"pattern": "^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$"
},
"status": {
"const": "APPROVED"
},
"category": {
"type": "string",
"maxLength": 50
},
"components": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"maxLength": 50
},
"format": {
"type": "string",
"maxLength": 50
},
"text": {
"type": "string",
"maxLength": 16384
},
"buttons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"maxLength": 50
},
"text": {
"type": "string",
"maxLength": 1024
},
"url": {
"type": "string",
"maxLength": 4096
},
"phone_number": {
"type": "string",
"maxLength": 64
}
},
"required": [
"type"
]
},
"maxItems": 10
}
},
"required": [
"type"
]
},
"maxItems": 10
},
"body": {
"type": "string",
"maxLength": 16384
},
"placeholders": {
"type": "integer",
"minimum": 0,
"maximum": 1000
},
"fingerprint": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"bodyFingerprint": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
}
},
"required": [
"name",
"language",
"status",
"category",
"components",
"body",
"placeholders",
"fingerprint",
"bodyFingerprint"
]
},
"maxItems": 4,
"minItems": 1
},
{
"type": "null"
}
]
}
},
"required": [
"name",
"language",
"body",
"parameters",
"matchLanguage",
"snapshot"
]
},
"audience": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "contacts"
}
},
"required": [
"kind"
]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "appointments"
},
"from": {
"type": "string",
"format": "date-time"
},
"to": {
"type": "string",
"format": "date-time"
},
"statuses": {
"type": "array",
"items": {
"type": "string",
"enum": [
"PENDING",
"CONFIRMED",
"NOW"
]
},
"maxItems": 3,
"minItems": 1,
"description": "Defaults to PENDING, CONFIRMED and NOW. Instants must satisfy from < to."
}
},
"required": [
"kind",
"from",
"to"
]
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"kind": {
"const": "segment"
},
"filters": {
"type": "object",
"additionalProperties": false,
"properties": {
"away": {
"type": "string",
"enum": [
"3w",
"1m",
"2m",
"3m"
]
},
"visits": {
"type": "string",
"enum": [
"none",
"one",
"recentRegular",
"regular"
]
},
"backToBack": {
"type": "string",
"enum": [
"once",
"repeated"
]
},
"lateRegular": {
"const": true
},
"noUpcoming": {
"const": true
},
"recentMissed": {
"const": true
},
"newCustomers": {
"const": true
},
"language": {
"type": "string",
"enum": [
"he",
"ar",
"en"
]
},
"notSentBefore": {
"const": true
},
"lastVisit": {
"type": "string",
"enum": [
"within30",
"notSince60",
"notSince90"
]
},
"overdue": {
"const": true
},
"missed": {
"const": true
},
"providerId": {
"type": "string",
"format": "uuid"
},
"visitedFrom": {
"type": "string",
"format": "date"
},
"visitedTo": {
"type": "string",
"format": "date"
}
},
"required": [],
"dependentRequired": {
"visitedFrom": [
"visitedTo"
],
"visitedTo": [
"visitedFrom"
]
}
},
"providerName": {
"anyOf": [
{
"type": "string",
"maxLength": 160,
"pattern": "^\\s*[\\s\\S]{0,80}\\s*$",
"description": "At most 160 JavaScript UTF-16 units in the submitted value and 80 Unicode codepoints after trimming. Blank becomes null."
},
{
"type": "null"
}
]
}
},
"required": [
"kind",
"filters"
]
}
]
},
"recipientCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"sentCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"failedCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"unknownCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"pendingCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"sendingCount": {
"type": "integer",
"minimum": 0,
"maximum": 300
},
"state": {
"type": "string",
"enum": [
"sending",
"done"
]
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"finishedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"stoppedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"pausedAt": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"stopCode": {
"anyOf": [
{
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
{
"type": "null"
}
]
}
},
"required": [
"campaignId",
"providerId",
"source",
"version",
"confirmation",
"template",
"audience",
"recipientCount",
"sentCount",
"failedCount",
"unknownCount",
"pendingCount",
"sendingCount",
"state",
"createdAt",
"finishedAt",
"stoppedAt",
"pausedAt",
"stopCode"
],
"description": "Current authorized campaign. version is the control revision, not a revision for every delivery update. Historical legacy_body campaigns retain body-only confirmation and continuation behavior; a snapshot is never fabricated for them. New campaigns use full_template. sent means provider acceptance, not proven delivery/read.",
"allOf": [
{
"if": {
"properties": {
"confirmation": {
"const": "legacy_body"
}
}
},
"then": {
"properties": {
"template": {
"properties": {
"snapshot": {
"type": "null"
}
}
}
}
},
"else": {
"properties": {
"template": {
"properties": {
"snapshot": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z0-9_]{1,512}$"
},
"language": {
"type": "string",
"pattern": "^[a-z]{2,3}(_[A-Za-z0-9]{2,4})?$"
},
"status": {
"const": "APPROVED"
},
"category": {
"type": "string",
"maxLength": 50
},
"components": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"maxLength": 50
},
"format": {
"type": "string",
"maxLength": 50
},
"text": {
"type": "string",
"maxLength": 16384
},
"buttons": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"maxLength": 50
},
"text": {
"type": "string",
"maxLength": 1024
},
"url": {
"type": "string",
"maxLength": 4096
},
"phone_number": {
"type": "string",
"maxLength": 64
}
},
"required": [
"type"
]
},
"maxItems": 10
}
},
"required": [
"type"
]
},
"maxItems": 10
},
"body": {
"type": "string",
"maxLength": 16384
},
"placeholders": {
"type": "integer",
"minimum": 0,
"maximum": 1000
},
"fingerprint": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"bodyFingerprint": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
}
},
"required": [
"name",
"language",
"status",
"category",
"components",
"body",
"placeholders",
"fingerprint",
"bodyFingerprint"
]
},
"minItems": 1,
"maxItems": 4
}
}
}
}
}
}
]
},
{
"type": "null"
}
]
},
"currentUnavailableReason": {
"anyOf": [
{
"const": "campaign_not_found"
},
{
"type": "null"
}
]
},
"replayed": {
"type": "boolean"
}
},
"required": [
"receipt",
"current",
"currentUnavailableReason",
"replayed"
],
"allOf": [
{
"if": {
"properties": {
"current": {
"type": "null"
}
}
},
"then": {
"properties": {
"currentUnavailableReason": {
"const": "campaign_not_found"
}
}
},
"else": {
"properties": {
"currentUnavailableReason": {
"type": "null"
}
}
}
}
],
"description": "Immutable accepted intent receipt plus current authorized state, which may be newer or unavailable. A successful create/continue/retry queues accepted work for the existing bounded sender; it does not prove recipient delivery. Exact replay never creates another campaign or repeats a control mutation."
} Errors and recovery
Input validation
413REQUEST_TOO_LARGEThe JSON request body exceeds 65,536 bytes.
415JSON_REQUIREDSend Content-Type: application/json.
Error responses declared in the contract (11)
The pinned contract shares generic error definitions across operations. This list is not an exhaustive list of runtime errors.
401 · Missing, invalid or expired Management credential.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 403 · Current integration/key/scope/resource authority denied, including a browser Origin. Old keys gain no campaign authority.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 405 · Unsupported method.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 409 · An operation UUID was reused with different input, another campaign is open, business capacity is exhausted, or no recipients remain. Read the returned code; never replace an uncertain command automatically.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 412 · Reviewed audience/template facts or control version changed. Recover an uncertain original command first; obtain a new preview/state only for a new deliberate action.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 413 · JSON body exceeds 65,536 bytes.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 415 · application/json is required.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 422 · Invalid request, UUID, query, cursor or precondition format.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 428 · Idempotency-Key and If-Match are required.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 429 · Request rate limit; honor Retry-After.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
} 503 · Temporary failure. Reads may be retried; for an uncertain command, retain its UUID and exact request and read campaign-operations first.
application/json · Error
-
errorobjectRequiredView nested fields
-
codestringRequired -
requestIdstring · uuidRequired -
retryAfterintegerOptionalminimum:1 -
additionalPropertiesno value allowedSchema rule
-
-
additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
{
"type": "object",
"additionalProperties": false,
"properties": {
"error": {
"type": "object",
"additionalProperties": false,
"properties": {
"code": {
"type": "string"
},
"requestId": {
"type": "string",
"format": "uuid"
},
"retryAfter": {
"type": "integer",
"minimum": 1
}
},
"required": [
"code",
"requestId"
]
}
},
"required": [
"error"
]
}