Skip to content

stock_reference/fulfillment_event ​

Overview ​

PropertyValue
Webhook typestock_reference/fulfillment_event
Kafka topicstock-reference.fulfillment-event
DirectionPlatform → Your endpoint

Description ​

Fired when a fulfillment lifecycle event occurs on a stock reference. These events track the integration status between the platform and external warehouse management systems (WMS), as well as critical stock alerts.

Trigger Conditions ​

  • A fulfillment request for a stock reference is accepted by the WMS
  • A fulfillment request is rejected by the WMS
  • A stock reference is successfully integrated into the WMS (INTEGRATED)
  • An integration error occurs (INTEGRATION_ERROR)
  • A stock reference is removed from WMS integration
  • The usable quantity falls below the criticalThreshold (CRITICAL_STOCK_LEVEL)
  • A stock reference is waiting for restocking (AWAITING_STOCK)

Message Envelope ​

json
{
  "header": {
    "organizationId": "org_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "messageId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "webhookId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "type": "stock_reference/fulfillment_event",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": { ... }
}

The body field contains the fulfillment event with the parent stock reference nested.

Note on organizationId resolution: This event uses an organizationIdAccessor pattern — the organizationId is read from data.stockReference.organizationId.

Body — Property Table ​

FulfillmentEvent Object ​

FieldTypeNullableDescription
idstring (uuid)NoUnique fulfillment event identifier
stockReferenceIdstring (uuid)NoParent stock reference ID
stockReferenceStockReferenceNoThe parent stock reference object (see below)
typeenumNoEvent type: FULFILLMENT_ACCEPTED, FULFILLMENT_REJECTED, INTEGRATED, INTEGRATION_ERROR, REMOVED, CRITICAL_STOCK_LEVEL, AWAITING_STOCK
levelenumNoSeverity level: NORMAL, WARNING, ERROR
messagestringYesOptional human-readable message describing the event
datestring (ISO 8601)NoTimestamp when the event occurred

StockReference Object ​

FieldTypeNullableDescription
idstring (uuid)NoUnique stock reference identifier
organizationIdstring (uuid)NoOrganization that owns this stock reference
locationIdstring (uuid)YesWarehouse location
productVariantIdstring (uuid)NoAssociated product variant
referencestringNoInternal reference code
skustringNoStock keeping unit
statusenumNoDRAFT, VALID, ON_HOLD, INVALID
modelenumNoPRODUCT or BUNDLE
physicalQuantityintegerNoTotal physical quantity
usableQuantityintegerNoAvailable quantity
reservedQuantityintegerNoReserved quantity
criticalThresholdintegerNoAlert threshold
createdAtstring (ISO 8601)NoCreation timestamp
updatedAtstring (ISO 8601)NoLast update timestamp

Full JSON Payload Sample ​

json
{
  "header": {
    "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "messageId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "webhookId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "type": "stock_reference/fulfillment_event",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": {
    "id": "e5f6a7b8-c9d0-1234-efab-345678901234",
    "stockReferenceId": "d4e5f6a7-b8c9-0123-defa-234567890123",
    "stockReference": {
      "id": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "locationId": "e5f6a7b8-c9d0-1234-efab-345678901234",
      "productVariantId": "f6a7b8c9-d0e1-2345-fabc-456789012345",
      "reference": "REF-TSHIRT-WHITE-M",
      "sku": "TSHIRT-WHITE-M",
      "status": "VALID",
      "model": "PRODUCT",
      "physicalQuantity": 3,
      "usableQuantity": 3,
      "reservedQuantity": 0,
      "criticalThreshold": 5,
      "lastSnapshotAt": "2024-03-15T08:00:00.000Z",
      "lastSnapshotValue": 10,
      "createdAt": "2024-03-10T09:00:00.000Z",
      "updatedAt": "2024-03-15T10:23:45.000Z"
    },
    "type": "CRITICAL_STOCK_LEVEL",
    "level": "WARNING",
    "message": "Usable quantity (3) is below critical threshold (5)",
    "date": "2024-03-15T10:23:45.000Z"
  }
}

Notes ​

  • This event uses organizationIdAccessor: (data) => data.stockReference.organizationId.
  • CRITICAL_STOCK_LEVEL events fire automatically when usableQuantity drops below criticalThreshold after a movement.
  • level: ERROR events (e.g., INTEGRATION_ERROR) indicate that operator intervention may be required.
  • FULFILLMENT_ACCEPTED and FULFILLMENT_REJECTED reflect WMS acknowledgments for outbound shipment requests.

HappyColis API Documentation