Subscribe to an Event Notification
Subscribe to an event to get notified when that event occurs with webhook notifications.
To set up a subscription:
- Specify the event type.
- Provide the app URL (the location receiving the notification).
- Set up all other notification preferences.
Suppliers can subscribe to more than one event for each subscription request.
About Authentication Options
OAuth is recommended to authenticate with this API.
To get more information about OAuth, see Authentication.
Authentication Method | authMethod | Usage |
---|---|---|
Basic | BASIC_AUTH | Authorization header that uses userName and password encoded as BASE64. |
HMAC | HMAC | Authorization header that uses HMACSHA256 and clientSecret |
OAuth | OAUTH | Authorization header that uses clientId and clientSecret and encoded in BASE64. |
If there are custom headers provided in headers field, then authURL
returns HTTPS status 200 and the response has the access_token
and expires_in
fields.
While making a notification request to endpointUrl
, the Walmart system will pass the access_token
in the headers with keys as authHeaderName
and value as Bearer <access_token>
along with any other custom headers provided in headers field.
Step 1: Test the Destination URL
Before creating the subscription, validate the destination URL (the location to receive the notification). Make sure the destination URL is a public HTTP or HTTPS URL.
To test it out, call the Create a test notification request (POST /webhooks/subscriptions)
and provide the required parameter values:
eventType
– Specifies the name of the event; for example, OFFER_UNPUBLISHED. For a complete list of available events, call the Retrieve event types request (GET /v3/webhooks/eventTypes).eventVersion
– Specifies the event version, which depends on the event type. For details about each event time, select that event in Notifications.resourceName
– Specifies the resource name to provide the delegated scope that it can access. This is the functional category for the event type; for example, Item.eventURL
– Specifies the destination URL to receive the event notification.
For a list of acceptable values for request parameters, see the Create a subscription request (POST /v3/webhooks/subscriptions).
The user receives a success message to verify that the notification set up with the Create a subscription request (POST /v3/webhooks/subscriptions) triggers the event.
Example Request
For a sample request, see the Create a test notification request (POST /webhooks/subscriptions).
Step 2: Create a Subscription
After verifying that the destination URL successfully receives notifications, create a subscription. Call the Create a subscription request (POST /v3/webhooks/subscriptions), and specify all required parameters. This step is similar to the call to the Create a test notification request (POST /webhooks/subscriptions).
To get a list of all available events and resource names available for subscription, use the Retrieve event types request (GET /v3/webhooks/eventTypes).
Specify values for the authDetails
parameters. For detailed descriptions of all request parameters, see the Create a subscription request (POST /v3/webhooks/subscriptions).
On success, Walmart creates the subscription and provides the subscription ID.
Step 3: Set Up Notification Acknowledgement
After Walmart sends the notification, the supplier system needs to send acknowledgement with HTTP 2xx. Set up the supplier system to respond to notifications with a standard HTTP status of 2xx.
If there is no 2xx status code acknowledgment, Walmart will retry three times to deliver the notification at intervals (5 minutes, 15 minutes, and 45 minutes) from the previous attempt.
(Optional) Step 4: Get a List of Active Notifications
To verify that the new notification is active, call the Retrieve all subscriptions request (GET /v3/webhooks/subscriptions). It will return all current subscriptions.
Receive Notifications for Each Event
After creating and testing the subscription, Walmart will push the notifications to the assigned destination URL whenever the event occurs.
Updated about 1 month ago