Integration flow
The main integration flow is the direct wrapper path around job creation, decision delivery, generation reporting, and beacons.
- 1
Import and initialize
CslClientInitialize the client with
baseUrl,getApiKey, and optionallydecisionDeliveryplus timing,wrapper_version, and error observation options. - 2
Create a job
Send app context and prompt information through
createJob(). The response returnsjob_idandslot_ids. - 3
Report generation started
Report model generation start through
reportGeneration(jobId, "started", request). - 4
Retrieve the decision
Retrieve the sponsor decision for the first slot through
getDecision(slotId)usingauto,websocket,polling, or callback-driven delivery. - 5
Continue and finish generation
Continue model generation and then report
finishedor, if needed,failed. - 6
Render fill or handle no-fill
On fill, render
creative, respectconstraints, and useasset_token. On no-fill, react toreasonandcs_declaration. - 7
Send beacons after fill
Send wrapper beacon events such as
rendered,visible_started,visible_ended, orclickedthroughsendBeacon().
What goes into `createJob()` today
Data flow: The job payload, including the prompt, is sent to the CSL, wavebird's middleware layer. It is not sent to the ad market. The CSL data firewall extracts only an abstract topic category and the language before any signal reaches external SSPs. Raw prompt text never leaves the CSL.
job_type,model_id,locale,consent, andslots_requestedform the minimum request shape.promptaccepts either a string or an object withtextand an optionaltoken_count_estimate.decisionDeliverycan beauto,websocket,polling, orcallbackat the client level.callback_urlopts a job into callback delivery even when the client-level mode is not"callback".- Optional fields include latency hints, client identifiers, routing hints, and callback settings for advanced delivery flows.
What comes back
- From
createJob()you get accepted job metadata ornullwhen the SDK falls back silently. - From
getDecision()you get pending or ready decisions, preservingconstraintsandcs_declaration. - From
sendBeacon()you get{ accepted, reason_code }.reportGeneration()always resolves.
node-server.ts
typescript
await client.reportGeneration(job.job_id, "started", {
generation_id: `gen_${job.job_id}`,
model_id: "gpt-4o-mini",
});
const slotId = job?.slot_ids[0];
const decision = slotId ? await client.getDecision(slotId) : null;
if (decision?.fill === true) {
await client.sendBeacon({
beacon_id: `rendered-${Date.now()}`,
asset_token: decision.asset_token,
beacon_type: "rendered",
occurred_at_ms_client: Date.now(),
});
}
await client.reportGeneration(job.job_id, "finished", {
generation_id: `gen_${job.job_id}`,
model_id: "gpt-4o-mini",
});Ask about integration
Start with Node direct for the recommended production-ready integration path.