Webhooks are not working  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Webhooks are not working

Postby sameermoin » Wed Nov 16, 2022 5:53 pm

Hi Everyone,

I enabled webhooks and subscribed for an event Inventory.Updated

Screenshot 2022-11-08 125147.jpg
Rest API Plugin


I subscribed for events:

2.jpg
Subscribed event


When I am trying to get the list of message responses I am getting nothing:

3.jpg
subscriber responses
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Webhooks are not working  Topic is solved

Postby Mike.Sheen » Wed Nov 16, 2022 6:06 pm

sameermoin wrote:Hi Everyone,

I enabled webhooks and subscribed for an event Inventory.Updated


Not a hell of a lot to go with here.

You need to make sure the WebHooksHostURL is reachable from the clients. This URL needs to be the URL of the Jiwa API.

A common mistake is to put http://localhost - which will work only from instances of Jiwa on the same machine as the API is running.

Another common mistake is using the public external DNS name without the correct hosts file entries or DNS records in place. One must be mindful of the network architecture and firewalls.

A simple test is to try putting the contents of the WebHooksHostURL into a browser on all machines expected to trigger a webhook - if it shows the Jiwa API metadata page, then that means it is reachable and should work.

Another place to look is in the SY_WebhookMessage and SY_WebhookMessageResponse tables. Using the API to look as you are won't reveal problems where the client could not reach the API to send the webhook in the first place - however, clients will fail over into an insert of these tables and will have messages in there the API won't know about until you restart the service.

From the screenshots you've provided my money is your WebHooksHostURL is not set correctly.

EDIT: I see I responded before you had added more information to your post.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Webhooks are not working

Postby sameermoin » Wed Nov 16, 2022 6:08 pm

I tested my URL via postman and it's working. Even I also tried webhook.site for dummy requests and that one also not working.

Does it create any logs if the response is failed ?
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Webhooks are not working

Postby Mike.Sheen » Wed Nov 16, 2022 6:10 pm

sameermoin wrote:I tested my URL via postman and it's working. Even I also tried webhook.site for dummy requests and that one also not working.


I don't think you're hearing what I've been saying.

if you copy paste the URL you configured in the WebhooksHostURL into a browser, what do you see? Is it the Jiwa API metadata page? If not, then you're doing it wrong.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Webhooks are not working

Postby sameermoin » Wed Nov 16, 2022 6:22 pm

yes it's taking me to metadata

4.jpg
metadata page
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Webhooks are not working

Postby Mike.Sheen » Wed Nov 16, 2022 6:26 pm

sameermoin wrote:Does it create any logs if the response is failed ?


Which response?

If you mean the client talking to the API to signal a potential webhook event, if there is an exception there it inserts into the SY_WebhookMessage with a not sent status - it's tried to inform the API of an event it might want to send to subscribers, but it was not able to service the request so it is put into the SY_WebhookMessage table for it to pick up the next time the service starts.

Check that table contents. If you have entries in there which are not sent, then you either have the WebHooksHostURL wrong, or it's not reachable by the clients.

If you mean the response the API gets from the webhook subscribers, then that goes into the SY_WebhookMessageResponse table.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Webhooks are not working

Postby Mike.Sheen » Wed Nov 16, 2022 6:28 pm

sameermoin wrote:yes it's taking me to metadata

4.jpg


You have an awfully long URL in your WebhooksHostURL. I also notice it is HTTPS - make sure you have valid certificates for it - do you have valid SSL certs for your WebhooksHostURL?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Webhooks are not working

Postby Mike.Sheen » Wed Nov 16, 2022 6:34 pm

And remember - if you make any changes to the system settings relating to the REST API, you need to restart that service before they have any effect.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Webhooks are not working

Postby sameermoin » Thu Nov 17, 2022 4:36 pm

Hi Mike,

Thanks for your help finally it's working. I still don't know what the issue is. Actually, I am using ngrok to make my localhost URL publically accessible. I updated the firewall settings for the port on which Jiwa API is running.
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1


Return to REST API

Who is online

Users browsing this forum: No registered users and 1 guest