Browse docs +

JavaScript

Send job and service updates using fetch.

Set BREEZE_SERVER to https://push.breezelabs.dev and store your key as the environment secret BREEZE_WEBHOOK_KEY.

Run this on the server in a Node.js environment with native fetch. Do not bundle the key into public website code.

js
const server = process.env.BREEZE_SERVER
const key = process.env.BREEZE_WEBHOOK_KEY
if (!server || !key) throw new Error('Configure Breeze server and webhook secret')

const response = await fetch(new URL('/v1/send', server), {
  method: 'POST',
  headers: {
    authorization: `Bearer ${key}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({ title: 'Job complete', message: 'Processing has finished', thread_id: 'jobs' }),
  signal: AbortSignal.timeout(20000),
})
const result = await response.json()
console.log({ status: response.status, request_id: result.request_id, data: result.data })
if (response.status !== 200) throw new Error(`Breeze returned ${response.status}; inspect the result before retrying`)

Explicitly check for 200 so that HTTP 207 partial success is not mistaken for complete success. Your application can handle each status separately; avoid an unlimited retry loop in catch.

Delivery results and retry guidance