Skip to content

Webhooks

Webhooks provide durable delivery for Cobbery updates.

Retries

Webhooks will have the following retry strategy:

InitialInterval: time.Second * 5
BackoffCoefficient: 3
MaximumInterval: time.Hour * 6
MaximumAttempts: 20

Last retry happens in a little over 76 hours, so any downtime must be resolved by then before Webhooks stop attempting delivery.

Webhook Events and Payloads

Webhooks all have the following structure:

interface Payload {
WebhookID: string
EventTimeMS: number // For ordering
OrgID: string
CampaignID: string
JobID: string
Event: string // the event type, see different event types below
Data: {} // nested JSON, structure depends on `Event`
TestJob: boolean // TestJob copied from the Job.Data
}

Event: job_state_updated

Sent when ever a Job state is updated (that’s relevant to you).

Data:

interface JobStateUpdatedData {
State:
| "created"
| "scheduled"
| "calling"
| "analyzing"
| "completed"
| "failed"
| "canceled"
| "deleting"
| "deleted"
}

Register Webhook

POST /webhooks

Request body:

interface RegisterWebhookBody {
DestinationURL: string // the full URL to send a request to
}

Response

201 application/json:

interface RegisterWebhookResponse {
WebhookID: string
}

List Webhooks

GET /webhooks

Response

200 application/json:

interface ListWebhooksResponse {
Webhooks: {
OrgID: string
ID: string
Data: {
DestinationURL: string
}
CreatedAt: time.Time
}[]
}

Delete Webhook

Blindly submits a synchronous delete, if the webhook does not exist it will still return a 200.

DELETE /webhooks/:webhookID

Response

202 Response: Deleted (if exists)