Feature request: Add information to webhook payload

I've setup a webhook to trigger the revalidation of specific paths in my nextjs (v12.2) project.

Unfortuantely I'm struggling with the limited data provided in the payload. Specifically the two points:

  1. Localisation - I have several locales setup in Prismic, however the payload does not separate documents by the locale and therefore I'll have to rebuild every single document on every single locale, which as you can imagine is really ineffcient.

Is this something the development team would consider adding? Having this separation would considerably improve the usability of the webhook functionality for manually purging cache on document publish/unpublish

Either having the documents separated by locale e.g:

  "documents": [
    "en-gb": [ <array of document ids for this locale],
    "en-us": [ <array of document ids for this locale],
    ...
  ],

or even just listing the locales where the changes have occured e.g:

  "localisation": [
    "en-gb",
    "en-us",
    ...
  ],
  1. Document types - The document array, whilst helpful, is somewhat limited in how useful this is. I think having an array of the document types would be more helpful for revalidating the specific paths.

Currently, I'm having to query the client by using client.getAllByIDs in order to access the document UID and type (which for the most part is what's used to generate the page path.

Hey @ollie1,

Thanks for describing your implementation! We have a blog post on ISR, which describes basically the solution you have created:

Basically, we recommend using client.getAllByIDs() as you describe. Currently, I don't think we have plans to change the webhook API. It seems like things are changing quickly in the ISR space right now, so I imagine we will probably wait a little while to see how things settle before we revisit this API. However, I'll track this as a feature request and share it with the product team. I'll also leave it here as a feature request so other users can upvote or add use cases :slight_smile:

Sam

1 Like