The following guide describes some best practices for working with webhooks.
PRODUCT_DELETED
webhook before a PRODUCT_UPDATED
webhook.
The createdAt
field of each webhook can be used to determine whether the webhook you’ve received is old. For instance, you could track the greatest createdAt
value you’ve observed for each product, and then use that to skip processing the earlier PRODUCT_UPDATED
event.
The most reliable way to ensure you have the most up-to-date data is to fetch it from our API. In the case of product webhooks, this would mean calling productByID
instead of relying on the product data inside the webhook payload.
id
field which can be used to detect duplicates. We recommend the following strategy:
id
at the beginning of your webhook handler.id
. You will need persistent storage for this (e.g. you could store all webhooks inside a SQL table, or store all webhook IDs within a key-value store like Redis).id
, then bail out of the webhook handler.id
.productByID
for each product you’re tracking every day at noon to ensure you haven’t missed anything.