Subscribe to an event notification
With webhook notifications, you can subscribe to an event and be notified when it occurs. To set up a subscription, specify the event type, provide the app URL where you want to receive the notification, and set up all other notification preferences.
You can subscribe to more than one event per subscription request.
About authentication options
You have several options to authenticate with this API. However, OAuth is recommended. For more information about OAuth, refer to this Authentication help article.
Authentication Method | authMethod | Usage |
---|---|---|
Basic | BASIC_AUTH | The authorization header uses the user name and password encoded as BASE64. |
HMAC | HMAC | The authorization header uses HMACSHA256and clientSecret |
OAuth | OAUTH | The authorization header uses clientId and clientSecret and is encoded in BASE64. |
If there are custom headers provided in the headers field, then authURL
should return HTTPS status 200, and the response should have access_token
and expires_in
the field. While making a notification request to endpointUrl, the Walmart system will pass access_token in headers with authHeaderName as key and value as Bearer <access_token> along with any other custom headers provided in the headers field.
About resource authorization
To subscribe to an event of a resource, you must have the delegated access scope for that resource. Each resource (such as an Item or Feed) has permissions mapped based on Delegated Access.
If your delegated access scope for ITEM is view_only/ full_access
, you can subscribe to all events of the Resource ‘ITEM’. If your delegated access scope for ITEM is no_access
, you cannot subscribe to any events of the Resource ‘ITEM’.
However, you can fetch details of event types and subscriptions for all Resources irrespective of delegated access scopes.
Step 1: Test your destination URL
Before you create the subscription, you should validate the destination URL where you want to receive the notification. Make sure that your destination URL is a public http or https URL.
To test it out, call the Test Notification API and provide the required parameter values:
eventType
– specify the name of the event (e.g. OFFER_UNPUBLISHED). For a complete list of available events, call the Event Types API.eventVersion
– his depends on the event type. For details about each event time, select that event in Notifications. For example, Offer Unpublished Event takes eventVersion V1.resourceName
– provide the delegated scope it can access, which is the functional category for the event type (such as Item).eventURL
– specify the destination URL to receive the event notification.
For a list of acceptable values for request parameters, see Create Subscription in the Reference.
You receive a success message to verify that the notification you set up with the Create Subscriptions API will trigger for your event.
Example request
For a sample request, see Test Notification API Reference.
Step 2: Create a subscription
You can create a subscription once you successfully verify that the destination URL receives notifications. To do so, call the Create Subscription API and specify all required parameters, similar to the call to the Test Notification API.
Use the Event Types API to get a list of all available events and resource names to which you can subscribe.
Specify the values for authDetails parameters. For detailed descriptions of all request parameters, see the Create Subscription API Reference.
Upon success, Walmart will create the subscription and provide you with the subscription ID.
Step 3: Set up notification acknowledgment
After Walmart sends the notification, your system must send an acknowledgment with HTTP 2xx. You must set up your 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, each time at 5 minutes, 15 minutes, and 45 minutes after the previous attempt.
(Optional) Step 4: Get a list of active notifications
To verify that your new notification is active, call the All Subscriptions API.
It will return all your current subscriptions.
Receive notifications for each event
After you create and test the subscription, Walmart will send notifications to your destination URL whenever an event occurs.
Updated about 1 month ago