How to identify which document was updated via webhook

Hey

We are trying to use the webhook to know which document has published, so we can fetch that particular document. But in webhook, we don't get any data through which we can identify that. is there any way to know that?

5 Likes

Hi @surinder, the Webhooks unfortunately do not specify what has changed, just that something has changed.

After you receive a webhook you could do a query based on the Last Publication Date to see which documents have been changed or added recently. But unfortunately this won’t tell you if anything has been archived.

Another option is to keep a snapshot of your content. When you receive a webhook, query all your content and compare this to your snapshot to see what changed.

I would love to see an improvement to the Webhooks that identifies what changes have been made, so I will let the @features-team know about this and they can add this to our feature request tracker as a possible improvement for the future.

1 Like

yes, it would be great if you can add it to feature list. It can making things easer for developers.

1 Like

I would love to see this implemented in the webhooks :slightly_smiling_face: It’s unnecessarily complicated to determine the changes right now. My use case is a serverless function without any kind of persistence layer that would do some work based on the changes (send an email etc.).

1 Like

The way we implemented it is similar to what Prismic guys suggested in their blog. We have a snapshot of the whole repository - uids and last published date in a dynamo table. After publishing we lookup this table and compare with the latest last published date of each document. If it changed then we create our release list. It might seem like an overkill but it works pretty well.

1 Like

Yes, that’s how we did.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.