Subscribing to inventory and fulfillment-related events

Subscribe to a webhook data feed to integrate the with an existing inventory solution. This will enable you to ensure that your inventory solution remains in sync, and can respond effectively to events generated on your ecommerce storefronts.

Before you begin

  • Ensure that you understand your organization's inventory management system and plan its integration with Inventory management.

About this task

Use the Webhook API to subscribe to -generated events. The following events are available.
Event Event description
Inventory status change (inv-status-change) This event is triggered when an inventory level for a particular SKU:
  • moves from in-stock to out-of-stock (drops to 0)
  • moves from out-of-stock to in-stock (moves above 0)
  • moves below set threshold
  • moves above set threshold
Inventory Location created When a new Inventory Location is created, this event is triggered.

The Inventory Webhook API endpoint is: /webhook/api/v1/subscriptions.

The API supports the following operations:
  • POST - Creates a subscription.
  • PUT /{id} - Updates a subscription.
  • GET - Retrieves all subscriptions for a specific event. If no event is specified, all subscriptions are returned.
  • GET /{id} - Retrieves a subscription by its ID.
  • DELETE /{id} - Deletes a subscription by its ID.
  • DELETE - Deletes all subscriptions.

Procedure

  1. Access to the webhook-service subscription REST APIs requires a service account. These APIs use Basic Authentication, meaning each request must include the service account's username and password in the HTTP headers. These credentials authenticate the service account and authorize its access to the APIs. By default, the username is set to webhook-service-account-user. The password is configured separately for each environment and should be obtained from the administrator. Both the username and password can be modified in the application.yml file or set as environment variables.
  2. Issue requests to the Webhook API endpoint to create, modify, or remove event subscriptions.
    Create a subscription to begin obtaining event data. Modify or remove any incorrect or unused subscriptions.
    A sample event subscription is as follows.
    {
      "url": "https://hostname:port/rest/admin/v1/fulfillment-centers",
      "method": "POST",
      "successResponseCode": 201,
      "event": "ffm-center-create",
      "auth": "BEARER_TOKEN",
      "template": "{\"extIdentifier\": \"{{fulfillmentCenterId}}\", \"memberId\": -41000, \"defaultShipOffset\": 86400, \"inventoryOperationFlags\": 8, \"maxNumPick\": 10, \"pickDelayInMin\": 10, \"dropShip\": \"N\", \"name\": \"{{fulfillmentCenterName}}\"}"
    } 
    Note: You can use two forms of authentication for subscriptions. The auth field can be specified to require a bearer token (BEARER_TOKEN), or basic user and password authentication (BASIL_AUTH). Contract to specify your basic authentication credentials.

Results

Your subscriptions to events are created, modified, or removed. Events are now sent to the endpoints that are defined.