Use Webhooks to Receive Catalog Notifications
The Catalog API supports the following webhook:
Event | Description |
---|---|
catalog.version.updated | The catalog was updated. Webhook notification data is packaged as "catalog_version": { "updated_at": "2019-05-14T17:51:27Z"} . |
Use the catalog.version.updated
webhook to build real-time notifications that help you keep your catalog in sync.
The catalog.version.updated
webhook sends an update when the seller's catalog is updated in any way. You can use this webhook as a notification to tell you when it is time to sync your catalog.
Did you know?
If you regularly poll SearchCatalogObjects
for updates, you can use this webhook and increase the length of time between your polls.
Subscribe to catalog.version.updated
You can subscribe to webhooks from any of your applications by opening the application details in the Developer Dashboard. For more information about webhooks, see Square Webhooks.
How catalog.version.updated works
This webhook sends a notification any time any catalog object is created, updated, or deleted.
For catalog.version.updated
notifications, the data
field includes a timestamp indicating when the catalog was last updated.
You do not need to use the updated_at
timestamp from the webhook in the recommended sync flow. It is provided for convenience, but the value you pass to SearchCatalogObjects
is the timestamp of the last time you synced.
When you receive a catalog.version.updated
notification, call the SearchCatalogObjects endpoint and set the begin_time
field to the timestamp of the last time you synced your catalog. This retrieves all the CatalogObjects updated after the timestamp listed in begin_time
.
You should store the latest_time
value returned by the SearchCatalogObjects
endpoint, so you can use it in your next call to SearchCatalogObjects
. Using a locally generated timestamp might cause you to miss updates as a result of time skew between the Square server and your application.
A sample call to SearchCatalogObjects
is as follows:
If you need more assistance, contact Developer Support or ask for help in the Developer Forums.