Message Types

A message represents a change or an action performed on a resource (like an Order or a Product). Messages can be seen as a subset of the change history for a resource inside a project. It is a subset because not all changes on resources result in messages. Messages can be pulled via a REST API, or they can be pushed into a Message Queue by defining a Subscription.

Message

The following fields and their meanings are common to all messages:

  • id - String
    The unique ID of the message. It can be safely used to remember the fact that this message was already processed.
  • version - Number
  • sequenceNumber - Number
    A message number in relation to other messages in the context of a specific resource. The sequenceNumber of the next message of this resource is guaranteed to be a successor of the sequenceNumber of the current message. In other words, it will be sequenceNumber + 1.
    sequenceNumber can be used to make sure that all messages of this resource are processed in correct order.
  • resource - Reference to an object
    A reference to the resource on which the change was performed.
  • resourceVersion - Number
    The version of the resource on which the change was performed.
  • resourceUserProvidedIdentifiers - UserProvidedIdentifiers - Optional
    User provided identifiers of the resource, such as key or orderNumber. Only present if the resource has such identifiers.
  • type - String
    The type of the message.
  • createdAt - DateTime
  • lastModifiedAt - DateTime

Each message may contain further fields that add information related to the change (for example, the fields of LineItemStateTransitionMessage when a transitionLineItemState update action is performed on an Order).

Message fields that can be used in query predicates: createdAt, lastModifiedAt, id, version, sequenceNumber, resource, resourceVersion, type.

UserProvidedIdentifiers

User-provided identifiers are not set by the API (like the id field is), but provided by the API user (like the key or orderNumber fields). They uniquely identify the resource, but may change over time. The value stored in the message corresponds to the one that was set at resourceVersion and it will stay like this even if it changes later on.

  • key - String - Optional
  • externalId - String - Optional
  • orderNumber - String - Optional
  • customerNumber - String - Optional
  • sku - String - Optional
  • slug - LocalizedString - Optional

For a Product, the slug field corresponds to the slug in the current projection.

Order Messages

These messages represent a change or an action performed on an Order.

LineItemStateTransitionMessage

This message is the result of the transitionLineItemState update action. In addition to the common Message fields, the LineItemStateTransition message contains the following fields:

  • type - String - "LineItemStateTransition"
  • lineItemId - String
  • transitionDate - DateTime
    The date and time, when state transition was actually performed
  • quantity - Number
  • fromState - Reference to a State
  • toState - Reference to a State

CustomLineItemStateTransitionMessage

This message is the result of the transitionCustomLineItemState update action. In addition to the common Message fields, the CustomLineItemStateTransition message contains the following fields:

  • type - String - "CustomLineItemStateTransition"
  • customLineItemId - String
  • transitionDate - DateTime
    The date and time, when state transition was actually performed
  • quantity - Number
  • fromState - Reference to a State
  • toState - Reference to a State

DeliveryAddedMessage

This message is the result of the addDelivery update action. In addition to the common Message fields, the DeliveryAdded message contains the following fields:

  • type - String - "DeliveryAdded"
  • delivery - Delivery

The Delivery will not contain Parcels if those were part of the initial addDelivery command. In that case an additional ParcelAddedToDeliveryMessage will be emitted containing the Parcels.

DeliveryRemovedMessage

This message is the result of the removeDelivery update action. In addition to the common Message fields, DeliveryRemoved message contains the following fields:

  • type - String - "DeliveryRemoved"
  • delivery - Delivery

DeliveryItemsUpdatedMessage

This message is the result of the setDeliveryItems update action. In addition to the common Message fields, DeliveryItemsUpdated message contains the following fields:

  • type - String - "DeliveryItemsUpdated"
  • deliveryId - String - ID of the delivery
  • items - Array of DeliveryItem
  • oldItems - Array of DeliveryItem

ParcelAddedToDeliveryMessage

This message is the result of the addParcelToDelivery update action. In addition to the common Message fields, the ParcelAddedToDelivery message contains the following fields:

  • type - String - "ParcelAddedToDelivery"
  • delivery - Delivery
    The delivery updated with the added parcel.
  • parcel - Parcel
    The added parcel.

ParcelRemovedFromDeliveryMessage

This message is the result of the removeParcelFromDelivery update action. In addition to the common Message fields, ParcelRemovedFromDelivery message contains the following fields:

  • type - String - "ParcelRemovedFromDelivery"
  • deliveryId - String - The ID of the delivery the parcel was removed from
  • parcel - Parcel - The removed parcel

ParcelTrackingDataUpdatedMessage

This message is the result of the setParcelTrackingData update action. In addition to the common Message fields, ParcelTrackingDataUpdated message contains the following fields:

  • type - String - "ParcelTrackingDataUpdated"
  • deliveryId - String - ID of the affected delivery
  • parcelId - String - ID of the parcel which has been affected
  • trackingData - TrackingData - Optional

ParcelMeasurementsUpdatedMessage

This message is the result of the setParcelMeasurements update action. In addition to the common Message fields, ParcelMeasurementsUpdated message contains the following fields:

  • type - String - "ParcelMeasurementsUpdated"
  • deliveryId - String - ID of the affected delivery
  • parcelId - String - ID of the parcel which has been affected
  • measurements - ParcelMeasurements - Optional

ParcelItemsUpdatedMessage

This message is the result of the setParcelItems update action. In addition to the common Message fields, ParcelItemsUpdated message contains the following fields:

  • type - String - "ParcelItemsUpdated"
  • deliveryId - String - ID of the affected delivery
  • parcelId - String - ID of the parcel
  • items - Array of DeliveryItem
  • oldItems - Array of DeliveryItem

DeliveryAddressSetMessage

This message is the result of the SetDeliveryAddress update action. In addition to the common Message fields, DeliveryAddressSet message contains the following fields:

  • type - String - "DeliveryAddressSet"
  • deliveryId - String - The ID of the Delivery which has been updated.
  • address - Address - Optional
  • oldAddress - Address - Optional

ReturnInfoAddedMessage

This message is the result of the addReturnInfo update action. In addition to the common Message fields, the ReturnInfoAdded message contains the following fields:

  • type - String - "ReturnInfoAdded"
  • returnInfo - ReturnInfo

OrderCreatedMessage

This message is created when a cart is ordered. In addition to the common Message fields, the OrderCreated message contains the following fields:

  • type - String - "OrderCreated"
  • order - Order

OrderImportedMessage

This message is created when an order is imported. In addition to the common Message fields, the OrderImported message contains the following fields:

  • type - String - "OrderImported"
  • order - Order

OrderStateChangedMessage

This message is created when the OrderState is changed. In addition to the common Message fields, the OrderStateChanged message contains the following fields:

OrderStateTransitionMessage

This message is the result of the transitionState update action. In addition to the common Message fields, the OrderStateTransition message contains the following fields:

OrderCustomerEmailSetMessage

This message is created when the customer email of an existing order is modified. In addition to the common Message fields, the OrderCustomerEmailSet message contains the following fields:

  • type - String - "OrderCustomerEmailSet"
  • email - String - Optional
  • oldEmail - String - Optional

OrderCustomerSetMessage

This message is created when the customer ID of the existing order is modified. In addition to the common Message fields, the OrderCustomerSet message contains the following fields:

OrderCustomerGroupSetMessage

This message is created when the customer group of the existing order is modified. In addition to the common Message fields, the OrderCustomerGroupSet message contains the following fields:

OrderShippingAddressSetMessage

This message is created when the shipping address of an existing order is changed. In addition to the common Message fields, the OrderShippingAddressSet message contains the following fields:

  • type - String - "OrderShippingAddressSet"
  • address - Address - Optional
  • oldAddress - Address - Optional

OrderBillingAddressSetMessage

This message is created when the billing address of an existing order is modified. In addition to the common Message fields, the OrderBillingAddressSet message contains the following fields:

  • type - String - "OrderBillingAddressSet"
  • address - Address - Optional
  • oldAddress - Address - Optional

OrderPaymentStateChangedMessage

This message is the result of the changePaymentState update action. In addition to the common Message fields, the OrderPaymentStateChanged message contains the following fields:

  • type - String - "OrderPaymentStateChanged"
  • paymentState - PaymentState
    The payment state the order was changed to.
  • oldPaymentState - PaymentState - Optional The payment state the order was changed from.

OrderShipmentStateChangedMessage

This message is the result of the changeShipmentState update action. In addition to the common Message fields, OrderShipmentStateChanged message contains the following fields:

  • type - String - "OrderShipmentStateChanged"
  • shipmentState - ShipmentState The shipment state the order was changed to.
  • oldShipmentState - ShipmentState The shipment state the order was changed from.

OrderReturnShipmentStateChangedMessage

This message is the result of the setReturnShipmentState update action. In addition to the common Message fields, OrderReturnShipmentStateChanged message contains the following fields:

  • type - String - "OrderReturnShipmentStateChanged"
  • returnItemId - String - The ID of the return item that was changed.
  • returnShipmentState - ReturnShipmentState The state of the return shipment the return item was changed to.

OrderEditAppliedMessage

This message is the result of the OrderEdit application. Additional message fields:

OrderCustomLineItemAdded

This message is the result of the AddCustomLineItem update action.

Additional message fields:

  • type - String - "OrderCustomLineItemAdded"
  • customLineItem - CustomLineItem

OrderCustomLineItemRemoved

This message is the result of the RemoveCustomLineItem update action.

Additional message fields:

  • type - String - "OrderCustomLineItemRemoved"
  • customLineItemId - String
  • customLineItem - CustomLineItem

OrderCustomLineItemQuantityChanged

This message is the result of the ChangeCustomLineItemQuantity update action.

Additional message fields:

  • type - String - "OrderCustomLineItemQuantityChanged"
  • customLineItemId - String
  • quantity - Number
  • oldQuantity - Number

OrderLineItemAddedMessage

This message is the result of the AddLineItem update action.

Additional message fields:

  • type - String - "OrderLineItemAdded"
  • lineItem - LineItem
  • addedQuantity - Number

OrderLineItemRemoved

This message is the result of the RemoveLineItem update action.

Additional message fields:

  • type - String - "OrderLineItemRemoved"
  • lineItemId - String
  • removedQuantity - Number
  • newQuantity - Number
  • newState - Array of ItemState
  • newTotalPrice - Money
  • newTaxedPrice - TaxedItemPrice - Optional
  • newPrice - Price - Optional
  • newShippingDetail - ItemShippingDetails - Optional

OrderLineItemDistributionChannelSet

This message is the result of the SetLineItemDistributionChannel update actions.

Additional message fields:

  • type - String - "OrderLineItemDistributionChannelSet"
  • lineItemId - String

OrderShippingInfoSetMessage

This message is the result of the SetShippingMethod and the SetCustomShippingMethod update actions.

Additional message fields:

OrderShippingRateInputSetMessage

This message is the result of the SetShippingRateInput update action.

Additional message fields:

OrderDiscountCodeAddedMessage

This message is the result of the addDiscountCode update action.

Additional message fields:

OrderDiscountCodeRemovedMessage

This message is the result of the RemoveDiscountCode update action.

Additional message fields:

OrderDiscountCodeStateSetMessage

This message is the result of a changing DiscountCodeState on a recalculation.

Additional message fields:

OrderLineItemDiscountSetMessage

This message is the result of a recalculation when a discount is set to a LineItem.

Additional message fields:

OrderCustomLineItemDiscountSetMessage

This message is the result of a recalculation when a discount is set to a CustomLineItem.

Additional message fields:

OrderStoreSetMessage

This message is the result of setting the store.

Additional message fields:

OrderDeletedMessage

This message is the result of the Delete Order request. In addition to the common Message fields, OrderDeleted message contains the following fields:

  • type - String - "OrderDeleted"
  • order - Order that has been deleted.

Product Messages

These messages represent a change or an action performed on a Product.

ProductCreatedMessage

This message is the result of the create product request. In addition to the common Message fields, the ProductCreated message contains the following fields:

  • type - String - "ProductCreated"
  • productProjection - ProductProjection
    The staged projection of the product at the time of creation.

ProductPublishedMessage

This message is the result of the publish update action. In addition to the common Message fields, the ProductPublished message contains the following fields:

  • type - String - "ProductPublished"
  • scope - String - The publishing scope
  • productProjection - ProductProjection
    The current projection of the published product.
  • removedImageUrls - Array of String
    List of images which were removed with this action.

ProductUnpublishedMessage

This message is the result of the unpublish update action. In addition to the common Message fields, the ProductUnpublished message contains the following field:

  • type - String - "ProductUnpublished"

ProductStateTransitionMessage

This message is the result of the transitionState update action. In addition to the common Message fields, the ProductStateTransition message contains the following fields:

  • type - String - "ProductStateTransition"
  • state - Reference to a State
  • force - Boolean

ProductSlugChangedMessage

This message is the result of the changeSlug update action. In addition to the common Message fields, the ProductSlugChanged message contains the following fields:

ProductImageAddedMessage

This message is the result of the addExternalImage update action and the upload of an image. In addition to the common Message fields, the ProductImageAdded message contains the following fields:

  • type - String - "ProductImageAdded"
  • variantId - Number
    The variantId to identify the variant to which the image was added.
  • image - Image
    The image that was added.
  • staged - Boolean
    true if it was applied only to staged.

ProductRevertedStagedChangesMessage

This message is the result of the revertStagedChanges update action. In addition to the common Message fields, the ProductRevertedStagedChanges message contains the following fields:

  • type - String - "ProductRevertedStagedChanges"
  • removedImageUrls - Array of String
    List of images which were removed with this action.

ProductPriceDiscountsSetMessage

This message is emitted when product price is updated based on the product discount. In addition to the common Message fields, the ProductPriceDiscountsSet message contains the following fields:

  • type - String - "ProductPriceDiscountsSet"
  • updatedPrices - Array of Objects that have the following fields:
    • variantId - Number
    • variantKey - String - Optional
    • sku - String - Optional
    • priceId - String
    • discounted - DiscountedPrice - Optional
    • staged - Boolean

ProductPriceExternalDiscountSetMessage

This message is the result of the setDiscountedPrice update action. In addition to the common Message fields, the ProductPriceDiscountsSet message contains the following fields:

  • type - String - "ProductPriceExternalDiscountSet"
  • variantId - Number
  • variantKey - String - Optional
  • sku - String - Optional
  • priceId - String
  • discounted - DiscountedPrice - Optional
  • staged - Boolean

ProductVariantAddedMessage

This message is the result of the addProductVariant update action. In addition to the common Message fields, the ProductVariantAdded message contains the following fields:

  • type - String - "ProductVariantAdded"
  • variant - ProductVariant
  • staged - Boolean

ProductVariantDeletedMessage

This message is the result of the removeProductvariant update action. In addition to the common Message fields, the ProductVariantDeleted message contains the following fields:

  • type - String - "ProductVariantDeleted"
  • removedImageUrls - Array of String
    List of images which were removed with this action.
  • variant - ProductVariant - Optional
    The variant which was deleted.

ProductAddedToCategoryMessage

This message is the result of the addToCategory update action. In addition to the common Message fields, the ProductAddedToCategory message contains the following fields:

  • type - String - "ProductAddedToCategory"
  • category - Reference to a Category
  • staged - Boolean

ProductRemovedFromCategoryMessage

This message is the result of the removeFromCategory update action. In addition to the common Message fields, the ProductRemovedFromCategory message contains the following fields:

  • type - String - "ProductRemovedFromCategory"
  • category - Reference to a Category
  • staged - Boolean

ProductDeletedMessage

This message is the result of the delete Product command. In addition to the common Message fields, the ProductDeleted message contains the following fields:

  • type - String - "ProductDeleted"
  • removedImageUrls - Array of String
    List of images which were removed with this action.
  • currentProjection - ProductProjection - Optional
    The current projection of the deleted product.

Category Messages

These messages represent a change or an action performed on a Category.

CategoryCreatedMessage

This message is the result of the create category request. In addition to the common Message fields, the CategoryCreated message contains the following fields:

  • type - String - "CategoryCreated"
  • category - Category
    The category at the time of creation.

CategorySlugChangedMessage

This message is the result of the changeSlug update action. In addition to the common Message fields, the CategorySlugChanged message contains the following fields:

Payment Messages

These messages represent a change or an action performed on a Payment.

PaymentCreatedMessage

This message is the result of a create action. In addition to the common Message fields, the PaymentCreated message contains the following fields:

  • type - String - "PaymentCreated"
  • payment - Payment
    The payment created.

PaymentInteractionAddedMessage

This message is the result of the addInterfaceInteraction update action. In addition to the common Message fields, the PaymentInteractionAdded message contains the following field:

  • type - String - "PaymentInteractionAdded"
  • interaction - CustomFields
    The payment interaction added.

PaymentTransactionAddedMessage

This message is the result of the addTransaction update action. In addition to the common Message fields, the PaymentTransactionAdded message contains the following fields:

  • type - String - "PaymentTransactionAdded"
  • transaction - Transaction
    The payment transaction added.

PaymentTransactionStateChangedMessage

This message is the result of the changeTransactionState update action. In addition to the common Message fields, the PaymentTransactionStateChanged message contains the following fields:

  • type - String - "PaymentTransactionStateChanged"
  • transactionId - String
    The id of the Transaction.
  • state - TransactionState
    The new state of the transaction.

PaymentStatusStateTransitionMessage

This message is the result of the transitionState update action. In addition to the common Message fields, the PaymentStatusStateTransition message contains the following fields:

  • type - String - "PaymentStatusStateTransition"
  • state - Reference to a State
  • force - Boolean

PaymentStatusInterfaceCodeSetMessage

This message is the result of the setStatusInterfaceCode update action. In addition to the common Message fields, the PaymentStatusInterfaceCodeSet message contains the following fields:

  • type - String - "PaymentStatusInterfaceCodeSet"
  • interfaceCode - String - Optional
    The interface code which was set.

Customer Messages

These messages represent a change or an action performed on a Customer.

CustomerCreatedMessage

This message is the result of the create customer request. In addition to the common Message fields, the CustomerCreated message contains the following fields:

  • type - String - "CustomerCreated"
  • customer - Customer
    The customer at the time of creation.

CustomerAddressChangedMessage

This message is the result of the changeAddress request. In addition to the common Message fields, CustomerAddressChanged message contains the following fields:

  • type - String - "CustomerAddressChanged"
  • address - Address - The updated address of the customer.

CustomerEmailChangedMessage

This message is the result of the changeEmail request. In addition to the common Message fields, CustomerEmailChanged message contains the following fields:

  • type - String - "CustomerEmailChanged"
  • email - String - The updated email of the customer.

CustomerEmailVerifiedMessage

This message is the result of the verify customers email request. In addition to the common Message fields, CustomerEmailChanged message contains the following fields:

  • type - String - "CustomerEmailVerified"

CustomerCompanyNameSetMessage

This message is the result of the setCompanyName request. In addition to the common Message fields, CustomerCompanyNameSet message contains the following fields:

  • type - String - "CustomerCompanyNameSet"
  • companyName - String - The name of the company, which was added to the user.

CustomerDateOfBirthSetMessage

This message is the result of the setDateOfBirth request. In addition to the common Message fields, CustomerDateOfBirthSet message contains the following fields:

  • type - String - "CustomerDateOfBirthSet"
  • dateOfBirth - Date - The date of birth of the customer.

CustomerGroupSetMessage

This message is the result of the setCustomerGroup request. In addition to the common Message fields, CustomerGroupSet message contains the following fields:

CustomerAddressRemovedMessage

This message is the result of the removeAddress request. In addition to the common Message fields, CustomerAddressRemoved message contains the following fields:

  • type - String - "CustomerAddressRemoved"
  • address - Address - The address, which was removed from the customer.

CustomerAddressAddedMessage

This message is the result of the addAddress request. In addition to the common Message fields, CustomerAddressAdded message contains the following fields:

  • type - String - "CustomerAddressAdded"
  • address - Address - The address, which was added to the customer.

CustomerPasswordUpdatedMessage

This message is the result of the Reset Customer's Password, the Reset Customer's Password in a Store, the Change Customer's Password, and the Change Customer's Password in a Store request. Furthermore, this message is produced upon the equivalent requests on the My Customer Profile endpoint. In addition to the common Message fields, CustomerPasswordUpdated message contains the following fields:

  • type - String - "CustomerPasswordUpdated"
  • reset - Boolean - true, if password has been updated during Customer's Password Reset workflow.

Review Messages

These messages represent a change or an action performed on a Review.

ReviewCreatedMessage

This message is the result of the create review request. In addition to the common Message fields, the ReviewCreated message contains the following fields:

  • type - String - "ReviewCreated"
  • review - Review The review at the time of creation.

ReviewStateTransitionMessage

This message is the result of the transitionState update action. In addition to the common Message fields, the ReviewStateTransition message contains the following fields:

  • type - String - "ReviewStateTransition"
  • oldState - Reference to a State - Optional
  • newState - Reference to a State
  • oldIncludedInStatistics - Boolean
    Indicates if this review was taken into account in the ratings statistics of the target before the state transition.
  • newIncludedInStatistics - Boolean
    Indicates if this review is taken into account in the ratings statistics of the target after the state transition.
  • target - Reference - Optional
  • force - Boolean

ReviewRatingSetMessage

This message is the result of the setRating update action. In addition to the common Message fields, the ReviewRatingSet message contains the following fields:

  • type - String - "ReviewRatingSet"
  • oldRating - Number - Optional
  • newRating - Number - Optional
  • includedInStatistics - Boolean
  • target - Reference - Optional

InventoryEntry Messages

These messages represent a change or an action performed on an InventoryEntry.

InventoryEntryCreatedMessage

This message is the result of the create InventoryEntry request. In addition to the common Message fields, the InventoryEntryCreated message contains the following fields:

  • type - String - "InventoryEntryCreated"
  • inventoryEntry - InventoryEntry

InventoryEntryDeletedMessage

This message is the result of the delete InventoryEntry request. In addition to the common Message fields, the InventoryEntryDeleted message contains the following fields:

  • type - String - "InventoryEntryDeleted"
  • sku - String
  • supplyChannel - Reference to a Channel
    Optional connection to a particular supplier.

InventoryEntryQuantitySetMessage

This message is the result of the update InventoryEntry with AddQuantity, RemoveQuantity or ChangeQuantity update action. Inventory changes as a result of Order creation do not trigger this message. In addition to the common Message fields, the InventoryEntryQuantitySet message contains the following fields:

  • type - String - "InventoryEntryQuantitySet"
  • oldQuantityOnStock - Number
  • newQuantityOnStock - Number
  • oldAvailableQuantity - Number
  • newAvailableQuantity - Number
Developer Center
HTTP APIGraphQL APIPlatform Release NotesCustom ApplicationsBETASDKs & Client LibrariesImport & ExportSUNRISE Starter FrontendsTutorialsFAQ
Copyright © 2021 commercetools