Page 1 of 1

Unsubscribed webhook events triggering.

PostPosted: Wed Jan 04, 2023 4:15 am
by sameermoin
I notice that default webhooks events that are even not subscribed are triggering to Jiwa API URL "http://localhost:8080/Webhooks/Events". At first, I thought this was something due to CustomPlugin on which I am using Custom Webhooks so I deactivated the custom plugin and found that events are still triggering even though on the fresh database, I also completely deleted the database and re-created a new one, and just enabled the rest-API plugin and the custom plugin named "Filter Webook" which was provided by the "Mike" on the previously asked topic.

webhook debugger.png


debtor.png


There is no subscriber created yet.
sql.jpg


Lastly, it can be controlled by short-circuiting a request inside "WebhooksEventsPOSTRequestFilter" as suggested on the previous topic, but in my case, I have some inventories which are linked together, and when they are updated it triggers for all the linked inventories individually, as this event is returning "InventoryItem" object on which some properties values are getting from DB queries, so obviously it affecting the performance.

Any way to stop it?

Re: Unsubscribed webhook events triggering.  Topic is solved

PostPosted: Wed Jan 04, 2023 8:02 am
by SBarnes
In terms of web hooks there is no check in the Business Logic for the subscribers or subscriptions, this actually done by the WebhooksEventsPOSTRequest, so when the event is sent to this route on the rest api the subscribers and subscriptions are checked before anything is added to the message queue.

The reason the check is done here is in case there is a change in terms of subscribers and subscriptions whilst the api is running and to centralise things in one spot.

You could modify the request filter Mike provided for you and any of your code to also do this check but the WebhooksEventsPOSTRequest is already stopping the hook going out so it would be redundant.

Re: Unsubscribed webhook events triggering.

PostPosted: Wed Jan 04, 2023 3:46 pm
by sameermoin
Hi Stuart,

Thanks for the response. The problem is I haven't subscribed to these events so why they are running themselves?

Re: Unsubscribed webhook events triggering.

PostPosted: Wed Jan 04, 2023 3:52 pm
by SBarnes
Like I said previously if you look in the Rest api plugin in the business logic section the save end fires regardless of subscribers or subscriptions and posts to the api.

It is when the api receives the event it determines whether or not to add it to the queue of messages.