Unsubscribed webhook events triggering.  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Unsubscribed webhook events triggering.

Postby sameermoin » Wed Jan 04, 2023 4:15 am

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?
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Unsubscribed webhook events triggering.  Topic is solved

Postby SBarnes » Wed Jan 04, 2023 8:02 am

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.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Unsubscribed webhook events triggering.

Postby sameermoin » Wed Jan 04, 2023 3:46 pm

Hi Stuart,

Thanks for the response. The problem is I haven't subscribed to these events so why they are running themselves?
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Unsubscribed webhook events triggering.

Postby SBarnes » Wed Jan 04, 2023 3:52 pm

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.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 37 guests