Webhooks or Middlewares

I am creating a collection that needs to trigger an event on an external resource upon creation.

I thought that Webhooks would be the ideal candidate but I have realised that it may not be as straightforward as I initially imagined.
The issue I am having is that I cannot narrow down the collection type that will trigger the Webhook i.e. if I set-up the Webhook with the entry.create event , I will be calling the external API on every entry creation not just the collection I want to initiate the event. Is there a way to filter what entries trigger the Webhook?

As an alternative I am considering using a Middleware, after await next(), to trigger the external event.

What is the usual process to follow in this scenario? I initially thought about creating an end-point in Strapi to use as the Webhook url, but that may add additional unnecessary load on Strapi.

Thoughts?

This topic has been created from a Discord post (1245325356467097601) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Anyone able to offer some advice here?
I am particularly interested to hear how people usually manage this

Just curious why it would be bad, to send webhooks for ALL models. Sure unnecessary, but couldn’t just you just discard the hook on the receiving ends for models you do not need?

The Webhook will call an API which triggers a lambda so that would add up in costs.

It’s called model lifecycle hooks

Thanks for that <@632956853122236457>, that was first consideration but I hesitated as eventually I would like to re-use the logic in other places.
Hence the need to filter the WebHook for specific resources.

Same issue, need help.

There is programmatic usage u can hook as many you want same time