How to create webhook for itemlisted and itemrevised events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 09:46 PM
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.
How to create webhook for itemlisted and itemrevised events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2024 09:26 PM
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
‌‌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!
How to create webhook for itemlisted and itemrevised events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2024 11:54 AM
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 Notifications: https://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
eBay Developer Support
How to create webhook for itemlisted and itemrevised events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2024 11:55 AM
like the old eBay Lego nice touch 🤗
