Webhooks

Configure webhooks to receive real-time notifications for inbox and message events.

Webhooks let you receive real-time notifications when events occur in your Sendook organization. Configure webhook endpoints to be notified of inbox changes, message deliveries, bounces, and more.

Available events

Webhooks support the following event types:

EventDescription
inbox.createdTriggered when a new inbox is created.
inbox.deletedTriggered when an inbox is deleted.
inbox.updatedTriggered when an inbox is updated.
message.sentTriggered when a message is sent from an inbox.
message.receivedTriggered when a message is received by an inbox.
message.deliveredTriggered when a message is successfully delivered.
message.bouncedTriggered when a message bounces.
message.complainedTriggered when a recipient marks a message as spam.
message.rejectedTriggered when a message is rejected before delivery.

Create a webhook

  • Method: POST
  • Path: /v1/webhooks
  • Auth: Required

Request body

{
  "url": "https://example.com/webhooks/sendook",
  "events": ["message.received", "message.delivered"]
}
FieldTypeRequiredDescription
urlstringYesHTTPS URL where webhook events will be sent.
eventsstringYesArray of event types to subscribe to (must contain at least one event).

Response 201 Created

{
  "id": "wh_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
  "url": "https://example.com/webhooks/sendook",
  "events": ["message.received", "message.delivered"],
  "createdAt": "2024-10-10T19:30:15Z",
  "updatedAt": "2024-10-10T19:30:15Z"
}

List webhooks

  • Method: GET
  • Path: /v1/webhooks
  • Auth: Required

Response 200 OK

[
  {
    "id": "wh_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
    "url": "https://example.com/webhooks/sendook",
    "events": ["message.received", "message.delivered"],
    "createdAt": "2024-10-10T19:30:15Z",
    "updatedAt": "2024-10-10T19:30:15Z"
  }
]

Retrieve webhook details

  • Method: GET
  • Path: /v1/webhooks/{webhookId}
  • Auth: Required

Path parameters

ParameterTypeDescription
webhookIdstringThe unique identifier of the webhook.

Response 200 OK

{
  "_id": "wh_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
  "url": "https://example.com/webhooks/sendook",
  "events": ["message.received", "message.delivered"],
  "createdAt": "2024-10-10T19:30:15Z",
  "updatedAt": "2024-10-10T19:30:15Z"
}

Test a webhook

  • Method: POST
  • Path: /v1/webhooks/{webhookId}/test
  • Auth: Required

Sends a test webhook event to verify your endpoint is configured correctly. The test event uses message.received with a test payload.

Path parameters

ParameterTypeDescription
webhookIdstringThe unique identifier of the webhook to test.

Response 200 OK

{
  "success": true
}

Delete a webhook

  • Method: DELETE
  • Path: /v1/webhooks/{webhookId}
  • Auth: Required

Deleting a webhook stops all event notifications to that endpoint.

Response 200 OK

{
  "id": "wh_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
  "url": "https://example.com/webhooks/sendook",
  "events": ["message.received", "message.delivered"],
  "createdAt": "2024-10-10T19:30:15Z",
  "updatedAt": "2024-10-10T19:30:15Z"
}

List webhook attempts

  • Method: GET
  • Path: /v1/webhooks/{webhookId}/attempts
  • Auth: Required

Retrieves the delivery history for a specific webhook, including successful deliveries and failures.

Path parameters

ParameterTypeDescription
webhookIdstringThe unique identifier of the webhook.

Response 200 OK

[
  {
    "id": "wa_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
    "webhookId": "wh_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
    "organizationId": "org_01J3ZP8K9M2N3O4P5Q6R7S8T9U",
    "inboxId": "ibox_01J3ZKZ0BRQ9SSJK1GRSCX4N4Z",
    "messageId": "msg_01J3ZN9SB2M5MHF5C2QBP4DT78",
    "timestamp": "2024-10-10T19:30:15Z",
    "payload": {
      "event": "message.received",
      "inboxId": "ibox_01J3ZKZ0BRQ9SSJK1GRSCX4N4Z",
      "messageId": "msg_01J3ZN9SB2M5MHF5C2QBP4DT78",
      "payload": {}
    },
    "status": 200,
    "error": null,
    "response": {
      "received": true
    },
    "createdAt": "2024-10-10T19:30:15Z",
    "updatedAt": "2024-10-10T19:30:15Z"
  }
]
FieldTypeDescription
idstringUnique identifier for the webhook attempt.
webhookIdstringThe webhook that was triggered.
organizationIdstringThe organization that owns the webhook.
inboxIdstringThe inbox associated with the event (if applicable).
messageIdstringThe message associated with the event (if applicable).
timestampstring (date-time)When the webhook was sent.
payloadobjectThe payload that was sent to the webhook endpoint.
statusintegerHTTP status code returned by the webhook endpoint.
errorstringError message if the delivery failed.
responseobjectResponse body returned by the webhook endpoint.

Webhook payload format

When an event occurs, Sendook sends a POST request to your webhook URL with the following payload structure:

{
  "event": "message.received",
  "inboxId": "ibox_01J3ZKZ0BRQ9SSJK1GRSCX4N4Z",
  "messageId": "msg_01J3ZN9SB2M5MHF5C2QBP4DT78",
  "payload": {
    // Event-specific payload data
  }
}
FieldTypeDescription
eventstringThe event type that triggered the webhook.
inboxIdstringThe inbox ID associated with the event (if applicable).
messageIdstringThe message ID associated with the event (if applicable).
payloadobjectEvent-specific data containing the full resource details.

Example webhook payload

For a message.received event:

{
  "event": "message.received",
  "inboxId": "ibox_01J3ZKZ0BRQ9SSJK1GRSCX4N4Z",
  "messageId": "msg_01J3ZN9SB2M5MHF5C2QBP4DT78",
  "payload": {
    "id": "msg_01J3ZN9SB2M5MHF5C2QBP4DT78",
    "subject": "Welcome to Sendook",
    "text": "Plain text version of the email.",
    "html": "<p>HTML version of the email.</p>",
    "labels": ["inbound"],
    "createdAt": "2024-10-10T19:22:10Z"
  }
}

Webhook delivery

  • Webhooks are sent via POST requests to your configured URL.
  • Your endpoint should respond with a 2xx status code to acknowledge receipt.
  • Failed deliveries may be retried automatically.
  • Ensure your endpoint is accessible via HTTPS and responds within 15 seconds.

Tip: Use the test endpoint to verify your webhook configuration before relying on it for production events.