cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create webhook for itemlisted and itemrevised events

Hii Shivam here,

Please help me to create webhooks related to these topics, i.e., ItemListed and ItemRevised.

I am stuck into SetNotificationPreferences Trading API not getting  a clear understanding on it so please help on these two points.

 

 

Thanks in Advance for the help.

Message 1 of 4
latest reply
3 REPLIES 3

How to create webhook for itemlisted and itemrevised events

To set up webhooks for ItemListed and ItemRevised using eBay's Trading API:

Register your URL: Log in to the eBay Developer Program and register your notification URL.
Set Notification Preferences: Use the SetNotificationPreferences API call with your eBay token and URL, enabling ItemListed and ItemRevised events:
xml
Copy code
‌:ebay:‌apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>YOUR_EBAY_AUTH_TOKEN</eBayAuthToken>
</RequesterCredentials>
<UserDeliveryPreferenceArray>
<NotificationEnable>
<EventType>ItemListed</EventType>
<EventEnable>Enable</EventEnable>
</NotificationEnable>
<NotificationEnable>
<EventType>ItemRevised</EventType>
<EventEnable>Enable</EventEnable>
</NotificationEnable>
</UserDeliveryPreferenceArray>
<ApplicationDeliveryPreferences>
<ApplicationURL>https://yourdomain.com/ebay_notifications</ApplicationURL>
<ApplicationEnable>Enable</ApplicationEnable>
</ApplicationDeliveryPreferences>
</SetNotificationPreferencesRequest>
Handle Notifications: Create a script to handle notifications at your URL. Here’s a simple PHP example:
php
Copy code
<?php
$rawPostData = file_get_contents('php://input');
file_put_contents('ebay_notifications.log', $rawPostData, FILE_APPEND);
$xml = simplexml_load_string($rawPostData);

if ($xml) {
switch ((string)$xml->NotificationEventName) {
case 'ItemListed':
// Handle ItemListed
break;
case 'ItemRevised':
// Handle ItemRevised
break;
}
} else {
file_put_contents('ebay_errors.log', 'Failed to parse XML: ' . $rawPostData, FILE_APPEND);
}
header('Content-Type: text/plain');
echo 'OK';
?>
Test: Send test notifications from eBay Developer Program and monitor your logs.

 

 

I hope this helps you!

upsers ups

Message 2 of 4
latest reply

How to create webhook for itemlisted and itemrevised events

Hi @shisha_9154,

 

Notifications can be delivered to a secure server/URL using the https protocol. This URL can be specified in your notification preferences. Use the ApplicationDeliveryPreferences.ApplicationURL field of the SetNotificationPreferences call to specify a URL to receive notifications for your application. Notifications will not be sent to any URL(s) if ApplicationDeliveryPreferencesType.ApplicationEnable is set to Disable.

 

For more details, check the "Notification Delivery URL Requirements" section here.

 

Subscribing to Platform Notificationshttps://developer.ebay.com/api-docs/static/platform-notifications-landing.html#subscribe

Triaging a Platform Notifications Problem: https://developer.ebay.com/support/kb-article?KBid=706

Best Regards,
eBay Developer Support
Message 3 of 4
latest reply

How to create webhook for itemlisted and itemrevised events

like the old eBay Lego nice touch ðŸ¤—

Message 4 of 4
latest reply