Skip to content

Webhook System Overview

Webhooks let your application receive real-time HTTP notifications whenever events occur in HappyColis. Instead of polling the API, you register an endpoint and HappyColis pushes event payloads to it as they happen.

Architecture

The queue is per-integration and processed in order. If a delivery fails, the queue enters a BLOCKED state and no further messages are sent to that subscriber until the situation is resolved.

Message Format

Every HTTP POST to your endpoint carries a JSON body with two top-level keys:

json
{
  "header": {
    "organizationId": "550e8400-e29b-41d4-a716-446655440000",
    "messageId":      "7b3f1c82-4d9a-4e2b-9c01-2a3b4c5d6e7f",
    "webhookId":      "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "type":           "order/created",
    "date":           "2026-03-16T12:00:00.000Z"
  },
  "body": {
    // event-specific payload
  }
}

Header fields

FieldTypeDescription
organizationIdUUIDThe organization that owns the resource that triggered the event
messageIdUUIDUnique identifier for this delivery attempt (use for dedup)
webhookIdUUIDID of the webhook subscription that received this message
typestringWebhook event type (see Available Events)
dateISO 8601Timestamp when the message was enqueued

Body

The body is the raw Kafka event payload for that domain event. Its structure depends on the event type.

Dispatch Flow Detail

  1. Kafka consumerNotificationProcessorController subscribes to all ORGANIZATION_TOPICS via the NestJS Microservices @EventPattern decorator.
  2. Formatter registry — each Kafka topic is mapped to a WebHookFormatterInterface in the formatter registry (see apps-notification-processor.module.ts). The DefaultTopicDataFormatter extracts organizationId from the payload and maps it to the correct WebhookType.
  3. Subscriber lookupIntegrationWebhooksQuery returns all IntegrationWebhookEntity rows matching the organization and event type.
  4. Queue enqueueQueueProcessor.process() persists an IntegrationQueueMessageEntity and emits a MessageInterface to the applications.message.process internal Kafka topic.
  5. HTTP deliveryQueueProcessor.send() fetches the application's clientSecret, builds the signed payload, and POSTs it to the subscriber's endPoint.
  6. Result handling — a 2xx response marks the message delivered and advances the queue. Any other response or exception marks the queue BLOCKED.

Available Events

Order Events

TypeDescription
order/createdOrder has been created
order/updatedOrder has been updated
order/completedOrder has been completed
order/cancelledOrder has been cancelled

Delivery Order Events

TypeDescription
delivery_order/createdDelivery order created
delivery_order/updatedDelivery order updated (defined in enum but not currently dispatched — no Kafka mapping)
delivery_order/openedDelivery order opened for fulfillment
delivery_order/pendingDelivery order is pending
delivery_order/cancelledDelivery order cancelled
delivery_order/completedDelivery order completed
delivery_order/fulfillment_acceptedFulfillment accepted by warehouse

Shipment Events

TypeDescription
shipment/createdShipment created
shipment/completedShipment completed (delivered)
shipment/shipping_eventCarrier tracking event received

Stock Reference Events

TypeDescription
stock_reference/createdStock reference created
stock_reference/updatedStock reference updated
stock_reference/movement_createdStock movement recorded
stock_reference/movement_updatedStock movement updated
stock_reference/fulfillment_eventFulfillment event on stock
stock_reference/sku_updatedSKU updated
stock_reference/status_updatedStatus changed

Product Events

TypeDescription
product/createdProduct created
product/updatedProduct updated
product/status_updatedProduct status changed
product/image/createdImage added to product
product/image/removedImage removed from product

Variant Events

TypeDescription
variant/createdVariant created
variant/updatedVariant updated
variant/status_updatedVariant status changed
variant/source_updatedVariant source changed
variant/model_changedVariant model changed
variant/tag/addedTag added to variant
variant/tag/removedTag removed from variant
variant/price/addedPrice added to variant
variant/price/removedPrice removed from variant
variant/image/createdImage added to variant
variant/image/removedImage removed from variant

Transfer Order Events

TypeDescription
transfer_order/createdTransfer order created
transfer_order/updatedTransfer order updated
transfer_order/cancelledTransfer order cancelled
transfer_order/completedTransfer order completed
transfer_order/openedTransfer order opened

Location Events

TypeDescription
location/createdLocation created
location/activatedLocation activated
location/updatedLocation updated
location/deactivatedLocation deactivated
location/type_changedLocation type changed
location/fulfillment_service_integration/createdFulfillment service integration created
location/fulfillment_service_integration/acceptedFulfillment service integration accepted
location/fulfillment_service_integration/erroredFulfillment service integration errored
location/fulfillment_service_integration/rejectedFulfillment service integration rejected

Collection & Catalog Events

TypeDescription
collection/createdCollection created
collection/updatedCollection updated
catalog/createdCatalog created
catalog/updatedCatalog updated

Vendor Events

TypeDescription
vendor/createdVendor created
vendor/updatedVendor updated

Next Steps

HappyColis API Documentation