Skip to content

stock_reference/movement_updated

Overview

PropertyValue
Webhook typestock_reference/movement_updated
Kafka topicstock-reference.movement-updated
DirectionPlatform → Your endpoint

Description

Fired when a stock movement is updated — typically when its status changes from PENDING to CONFIRMED or CANCELED.

Trigger Conditions

  • A pending stock movement is confirmed after warehouse processing
  • A pending stock movement is canceled before execution

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/movement_updated",
    "date": "2024-03-15T10:23:45.000Z"
  },
  "body": { ... }
}

The body field contains the updated movement 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

Root Object

FieldTypeNullableDescription
stockReferenceStockReferenceNoThe parent stock reference (see StockReference table)
movementStockMovementNoThe updated movement (see StockMovement table)

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

StockMovement Object

FieldTypeNullableDescription
idstring (uuid)NoUnique movement identifier
stockReferenceIdstring (uuid)NoParent stock reference ID
datestring (ISO 8601)NoDate when the movement occurred
quantityintegerNoRequested movement quantity
executedQuantityintegerNoActually executed quantity
natureenumNoORDER, RETURN, RECEPTION, WAREHOUSE_INVENTORY, SHOP_INVENTORY
typeenumNoINCREMENT or DECREMENT
quantityTypeenumNoRESERVED, AVAILABLE, or PHYSICAL
statusenumNoPENDING, CONFIRMED, or CANCELED
objectTypeenumYesDELIVERY_ORDER, RECEPTION, or RESERVATION
objectIdstringYesID of the source object
messagestringYesFree-text comment
metaobjectYesArbitrary metadata (JSON)
sourcestringYesSource identifier
batchNumberstringYesBatch or lot number
limitUsageDatestring (ISO 8601)YesExpiry / best-before date

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/movement_updated",
    "date": "2024-03-15T11:05:00.000Z"
  },
  "body": {
    "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": 148,
      "usableQuantity": 138,
      "reservedQuantity": 10,
      "criticalThreshold": 5,
      "lastSnapshotAt": "2024-03-15T08:00:00.000Z",
      "lastSnapshotValue": 150,
      "createdAt": "2024-03-10T09:00:00.000Z",
      "updatedAt": "2024-03-15T11:05:00.000Z"
    },
    "movement": {
      "id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
      "stockReferenceId": "d4e5f6a7-b8c9-0123-defa-234567890123",
      "date": "2024-03-15T10:23:45.000Z",
      "quantity": 2,
      "executedQuantity": 2,
      "nature": "ORDER",
      "type": "DECREMENT",
      "quantityType": "PHYSICAL",
      "status": "CONFIRMED",
      "objectType": "DELIVERY_ORDER",
      "objectId": "b8c9d0e1-f2a3-4567-bcde-678901234567",
      "message": null,
      "meta": null,
      "source": null,
      "batchNumber": null,
      "limitUsageDate": null
    }
  }
}

Notes

  • This event uses organizationIdAccessor: (data) => data.stockReference.organizationId.
  • The status field on the movement is the key changed field in this event (e.g., PENDINGCONFIRMED).

HappyColis API Documentation