> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kibocommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Notification Examples

This guide provides reference examples for several types of notifications. This does not cover all possible events, but includes both return and order topics that use the basic notification formatting in addition to the shipment topics that include additional metadata. For more general information about notification APIs, how they are formatted, or the full list of notification topics and the events that trigger them, refer to the [Event Notifications Overview](/pages/event-notifications-overview).

You can always retrieve more details about the object that triggered the event with a GET call to the appropriate API using the notification's `entityID` value, such as [GET Shipment](/api-reference/shipment/get-shipment), [GET Order](/api-reference/order/get-order), or [GET Return](/api-reference/return/get-return).

## Example 1: Return Event

Return event notifications are triggered whenever a return moves through steps in the return process: authorized, opened, cancelled, closed, rejected, or updated. This sample displays a Return Opened case which is indicated by the topic field.

```
{ 
   "eventId":"386ad355-0325-7v5r-9005-ab0c092k0054",
   "topic":"return.opened",
   "entityId":"1",
   "timestamp":"2019-11-21T21:03:23.666+00:00",
   "correlationId":"e6584f3a39024162b8ae31ff43aff3ed",
   "isTest":false
}
```

## Example 2: Product Event

In this example, a product was created. Similarly to the return notification example above, you can identify that it was a creation event by the topic. If the product was updated instead, then the topic would be `product.updated`.

```
{
   "eventId": "7ad800ec-b10e-41bc-8f19-adff0100bf54",
   "topic": "product.created",
   "entityId": "test",
   "timestamp": "2021-12-15T15:34:47.291735Z",
   "correlationId": "3284f9c8f0bd458d9f77a469463ad8db",
   "isTest": false
}
```

## Example 3: Order Events

When an order is updated, a notification is triggered to mark the event.

```
{ 
   "eventId":"a930fa59-bc8a-445f-826cab0d01168a32",
   "topic":"order.updated",
   "entityId":"0ed86f492b4835000195a24400006ca1",
   "timestamp":"2019-11-22T16:54:07.9337565Z",
   "correlationId":"6988cb955ee645b79199fa435395c94b",
   "isTest":false
}
```

This second sample is the notification for when an order is fulfilled, showing how the topic always indicates the kind of action that was performed.

```
{
   "eventId": "d2c317c0-ca2a-4ab9-8e05-adff010037aa",
   "topic": "order.fulfilled",
   "entityId": "12b2a4001effc80001f0063900007748",
   "timestamp": "2021-12-15T15:32:51.5220239Z",
   "correlationId": "09fdf82d22d1494ea82aad3317a5f0ea",
   "isTest": false
}
```

## Example 4: Shipment Status Event

Shipment status notifications are triggered whenever a shipment moves into a new status. Note that individual notifications are sent for each shipment on an order, all with the same `orderID`. All shipment events include additional metadata, such as the new and old statuses that a shipment moved between, in the `extendedProperties` object. The strings used in shipment status notifications are:

| Field                   | Description                                                                  |
| ----------------------- | ---------------------------------------------------------------------------- |
| orderId                 | The identifier of the order that the shipment belongs to.                    |
| oldStatus               | The name of the status that the shipment was previously in.                  |
| newStatus               | The name of the status that the shipment is transitioning to.                |
| fulfillmentLocationCode | The identifier of the fulfillment location that the shipment is assigned to. |

This example demonstrates how these parameters would be defined when a shipment moves into the Fulfilled status. Note that if this were a shipment moving into the initial Ready state, the notification would simply not include the `oldStatus` field.

```
{ 
   "eventId":"b30f10a5-333b-4058-9e44-ab0d01129bbf",
   "extendedProperties":[ 
      { 
         "key":"orderId",
         "value":"0ed86c6d7c87c20001ea1cdb00006ca1"
      },
      { 
         "key":"newStatus",
         "value":"FULFILLED"
      },
      { 
         "key":"oldStatus",
         "value":"READY"
      },
      { 
         "key":"fulfillmentLocationCode",
         "value":"338101"
      }
   ],
   "topic":"shipment.statuschanged",
   "entityId":"12",
   "timestamp":"2019-11-22T16:39:49.103+00:00",
   "correlationId":"8a29ee46c8254e32ba517c34e608ff23",
   "isTest":false
}
```

## Example 5: Shipment Workflow Event

Shipment workflow notifications are triggered whenever a shipment moves to another step in the fulfillment process. Note that individual notifications are sent for each shipment on an order, all with the same `orderID`. All shipment events include additional metadata in the `extendedProperties` object. The metadata strings used in shipment workflow notifications are:

| Field    | Description                                                   |
| -------- | ------------------------------------------------------------- |
| orderId  | The identifier of the order that the shipment belongs to.     |
| oldState | The name of the status that the shipment was previously in.   |
| newState | The name of the status that the shipment is transitioning to. |

This example demonstrates how these parameters would be defined for a Shipment Accepted notification, in which the shipment moves to the ACCEPTED\_SHIPMENT part of the fulfillment workflow.

```
{ 
   "eventId":"40603b02-21c9-41a3-9274-ab0d0103efc3",
   "extendedProperties":[ 
      { 
         "key":"orderId",
         "value":"0ed8606c2b4835000195a24100006ca1"
      },
      { 
         "key":"newState",
         "value":"ACCEPTED_SHIPMENT"
      },
      { 
         "key":"oldState",
         "value":"PRE_ACCEPT_SHIPMENT"
      }
   ],
   "topic":"shipment.workflowstatechanged",
   "entityId":"8",
   "timestamp":"2019-11-22T15:46:23.973+00:00",
   "correlationId":"af2976dc87eb4cdf81b124f34ee82f80",
   "isTest":false
}
```

## Example 6: Shipment Item Event

When an item in a shipment is adjusted, a notification is triggered to mark the event. Even though this topic refers to an item, the `entityID` is still the shipment number. All shipment events include additional metadata in the `extendedProperties` object. The metadata strings used in shipment item notifications are:

| Field   | Description                                               |
| ------- | --------------------------------------------------------- |
| orderId | The identifier of the order that the shipment belongs to. |
| lineId  | The identifier of the line item that was edited.          |

This example demonstrates how these parameters would be defined for a notification sent when a line item is edited.

```
{ 
   "eventId":"3db424e3-72eb-4686-9c18-ab0d011c30f5",
   "extendedProperties":[ 
      { 
         "key":"orderId",
         "value":"0ed86f492b4835000195a24400006ca1"
      },
      { 
         "key":"LineId",
         "value":"1"
      }
   ],
   "topic":"shipment.itemadjusted",
   "entityId":"13",
   "timestamp":"2019-11-22T17:14:42.3917824Z",
   "correlationId":"e467796f3920491b9890961a6bc1ddea",
   "isTest":false
}
```
