How to use pre defined Jiwa webhooks  Topic is solved

Discussions relating to the REST API of Jiwa 7.

How to use pre defined Jiwa webhooks

Postby NatashaDevon » Sun Jul 24, 2022 2:58 am

I check the webhook document on jiwa web but how can I use them in a custom plugin that was not mentioned there?

Is there any example plugin available for that?
NatashaDevon
I'm new here
I'm new here
 
Posts: 7
Joined: Sun Jul 24, 2022 2:53 am

Re: How to use pre defined Jiwa webhooks

Postby SBarnes » Sun Jul 24, 2022 8:53 am

Whilst not fully sure of what you are asking a web hook is not designed to be used by Jiwa itself but is rather used to send data to an external system when something happens in Jiwa, kind of a don't call us we'll call you when something happens scenario.

That being said I have found the use of using a webhook to call a custom route on the Jiwa api to do what would be called a double hop in that you might have a situation for example where the data provided by the webhook is not in the required format for an external system so you would call the custom route on the api itself reformat the data or collect any extra data and then make a call to the external system or do something else.

Adding custom routes is covered here https://docs.jiwa.com.au/display/J7UG/A ... e+REST+API

If this is not exactly the answer you are looking for give a bit more specifics in terms of what you are trying to achieve and we can try and give a bit more guidance to you to how you can achieve what you are trying to do.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: How to use pre defined Jiwa webhooks

Postby NatashaDevon » Sun Jul 24, 2022 5:30 pm

I am asking for the example plugin in which the third-party endpoint is registered and from where these webhooks are triggered. Is there any example webhooks with some xyz domain?
NatashaDevon
I'm new here
I'm new here
 
Posts: 7
Joined: Sun Jul 24, 2022 2:53 am

Re: How to use pre defined Jiwa webhooks

Postby SBarnes » Sun Jul 24, 2022 5:48 pm

To register third party endpoints see the following link https://docs.jiwa.com.au/display/J7UG/W ... bscription

Basically using the routes mentioned in the instructions will create the appropriate entries in the tables SY_WebhookSubscriber and SY_WebhookSubscription as needed, these tables are used by the webhook system to push data to the appropriate end points.

Alternately the following link offers a free maintenance screen viewtopic.php?f=32&t=1352&p=5769&hilit=webhook#p5769 that I wrote that is not supported in any way by Jiwa, be aware if you use the screen you must restart the api to get the subscribers and subscriptions to be available and the screen does not support any custom headers like the api does, it only supports subscribers and subscriptions.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: How to use pre defined Jiwa webhooks

Postby NatashaDevon » Sun Jul 24, 2022 7:27 pm

The plugin you shared is a little complex. Can you share an example of using a webhook for debtor creation?

like once a debtor is created send its information on xyz website.
NatashaDevon
I'm new here
I'm new here
 
Posts: 7
Joined: Sun Jul 24, 2022 2:53 am

Re: How to use pre defined Jiwa webhooks

Postby SBarnes » Sun Jul 24, 2022 7:51 pm

If you look at the instructions here https://docs.jiwa.com.au/display/J7UG/W ... bscription and ignore the plugin which provides a screen inside Jiwa to make if possible to do it in Jiwa, you don't need a plugin, you simply need to register a subscriber and then the appropriate subscriptions for the events you wish to receive.

As stated registering a subscriber and subscriptions through the api will make the necessary entries in the tables inside the Jiwa database so that the webhooks system will send the data for the events to the appropriate endpoints when the events happen in Jiwa.

In other words it's the data in these tables that will make the whole thing work, not code, the code exists out of the box with Jiwa to make the whole thing work provided there is data in the tables to act as as the instructions on what to do and when.

The list of possible events you can create a subscription to are covered here https://docs.jiwa.com.au/display/J7UG/W ... hookEvents
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: How to use pre defined Jiwa webhooks

Postby NatashaDevon » Sun Jul 24, 2022 8:03 pm

The problem is I want to customize the object field according to the third-party application. I don't have control over them so I want to customize some property mapping in Jiwa Plugin.


That's why I am asking for the plugin example so that I can modify the object properties.

SO, what I want to do is to trap the webhook and modify the object with some additional fields then send it to third-party application endpoint.
NatashaDevon
I'm new here
I'm new here
 
Posts: 7
Joined: Sun Jul 24, 2022 2:53 am

Re: How to use pre defined Jiwa webhooks

Postby SBarnes » Sun Jul 24, 2022 8:22 pm

What you are wanting to do is reasonably complex and would require the use of either a custom webhook or a custom route and double hopping the steps, which is fairly complex and there is no example I could provide as unfortunately whilst having done these types of things before the code is part of much bigger projects and can't be extracted due to their proprietary nature.

Jiwa themselves have a help desk at https://helpdesk.jiwa.com.au/ they should be able to provide you with a quote on developing something for you if you give them details of your requirements.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: How to use pre defined Jiwa webhooks

Postby NatashaDevon » Mon Jul 25, 2022 1:44 am

It is possible to trap the events?

like debitor created/updated, inventory created/updated?
NatashaDevon
I'm new here
I'm new here
 
Posts: 7
Joined: Sun Jul 24, 2022 2:53 am

Re: How to use pre defined Jiwa webhooks

Postby SBarnes » Mon Jul 25, 2022 10:04 am

Yes you can the REST API plugin does this to implement the webhooks in the Business logic section, you shouldn't change this plugin however as it needs to be overridden as part of an upgrade.

Being able to attach to these events won't actually send the data through that's part of what the webhooks do including resends on failure and logging the messages already baked in.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Next

Return to REST API

Who is online

Users browsing this forum: No registered users and 3 guests

cron