Strapi webhooks best practice

Hi
Today I was working with Strapi webhooks and realize that when you create a new webhook and set it for update entries it will trigger every time any entry updates. You can filter your desired model.
But the missing point, this is not a good practice because it will your call your API even when you don’t need it and you must filter webhook result.
Consider I have a contact form entry(model) and I create webhook to send email notification to the user whenever I got new contact request.
This webhook runs every time on any entry update even if its not contact model.
How we can trigger a webhook only for certain entry events?

Do you have any idea, guys? @sunnyson @DMehaffy @MattieBelt

You can use lifecycles for this, with afterCreate function.
https://strapi.io/documentation/developer-docs/latest/concepts/models.html#lifecycle-hooks

That one will be triggered only when a Contact form entry is created.

4 Likes

Good information thanks for sharing
VMware Engineer