Send Webhook Messages with content-type application/json  Topic is solved

Discussions relating to the REST API of Jiwa 7.

Send Webhook Messages with content-type application/json

Postby Joe.Thorpe » Fri Jul 01, 2022 5:12 pm

Hi Mike / Scott,

We're using JIWA's webhooks through a Microsoft Power Automate Custom Connector. Power Automate requires webhook messages to have a content-type of application/json (https://docs.microsoft.com/en-us/connec ... ok-trigger)

I modified this code in the REST API Plugin (v7.2.1.23 line 29348 in WebhookController.CallWebhook) to specify the content type:
subscription.URL.PostStringToUrl(message.Body,
contentType: "application/json",
requestFilter: webRequest =>


This works, but would it be possible for you to make this change in a future version of a the plugin? That way, i wouldn't need to patch the plugin each time there's an update.


Power Automate Custom Connectors have some other requirements, but i was able to workaround them with a seperate plugin. I'm happy to talk about that if you're interested in supporting PA Custom Connectors out of the box.

Cheers,
Joe
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Send Webhook Messages with content-type application/json

Postby Mike.Sheen » Fri Jul 01, 2022 5:18 pm

Hi Joe,

We already support the adding of any desired header to a webhook POST without modifying the plugin.

You can add request headers via the PUT request on /Webhooks/Subscribers/{SubscriberID}/Subscriptions/{SubscriptionID}/RequestHeaders/

Mike
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Send Webhook Messages with content-type application/json

Postby Joe.Thorpe » Fri Jul 01, 2022 6:30 pm

Hi Mike,

Thanks for the suggestion. I did try that, but you can't modify the Content-Type header this way.

The SY_WebhookMessageResponse record shows:
The 'Content-Type' header must be modified using the appropriate property or method.
Parameter name: name

This is a limitation (security feature?) of the underlying .NET library (https://stackoverflow.com/questions/450 ... rty-or-met)
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm

Re: Send Webhook Messages with content-type application/json  Topic is solved

Postby Mike.Sheen » Fri Jul 01, 2022 6:34 pm

Joe.Thorpe wrote:Hi Mike,

Thanks for the suggestion. I did try that, but you can't modify the Content-Type header this way.

The SY_WebhookMessageResponse record shows:
The 'Content-Type' header must be modified using the appropriate property or method.
Parameter name: name

This is a limitation (security feature?) of the underlying .NET library (https://stackoverflow.com/questions/450 ... rty-or-met)


Correct - we fixed this in DEV-8635 - I thought we had also applied a fix to the 7.2.1 branch - but it does not look like it.

In any case, it is fixed in the next version - so your fears of your temporary fix being un-done in the next release can be put to rest.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Send Webhook Messages with content-type application/json

Postby Joe.Thorpe » Fri Jul 01, 2022 6:38 pm

Oh awesome, thanks!
Joe.Thorpe
Occasional Contributor
Occasional Contributor
 
Posts: 19
Joined: Fri Jun 11, 2021 1:57 pm


Return to REST API

Who is online

Users browsing this forum: No registered users and 2 guests