Webhook: Handling XML payload

Created on 1 Mar 2018  Â·  6Comments  Â·  Source: adnanh/webhook

Hi and thanks for a very nice tool!

I have been trying to set up the webhook to accept an XML payload. So far I am failing quite miserably. I have tried to just pass on the entire payload both as an environment variable or a file but it is failing and just producing a 'null' content.

If I do a POST without a content type header set, then I do seem to get the xml payload output as an escaped JSON string.... not really what I am hoping for.

Is there a reason why really only JSON seems to be supported?

Thanks,
Daniel

enhancement

All 6 comments

Hey Daniel, thanks for writing up. The reason why only JSON (and formdata) seems to be supported is that I never needed to ingest other types of payload.

Adding XML right now would require a bit of thought how to fit it in properly. (i.e. using xpath for referencing values, etc...)

Would adding support to webhook to pass the raw request payload without attempting to parse it help you in any way? But then again, what benefits would webhook provide to you in that case :-(

Dear Adnan,

Thank you for your reply. Unfortunately we have already moved towards
another solution, but yes being able to pass the raw request paylout would
have been sufficient as far as I remember!

Best wishes,
Daniel

On Thu, Apr 12, 2018 at 11:41 AM, Adnan Hajdarević <[email protected]

wrote:

Hey Daniel, thanks for writing up. The reason why only JSON (and formdata)
seems to be supported is that I never needed to ingest such payload.

Adding XML right now would require a bit of thought how to fit it in
properly. (i.e. using xpath for referencing values, etc...)

Would adding support to webhook to pass the raw request payload without
attempting to parse it help you in any way? But then again, what benefits
would webhook provide to you in that case :-(

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/adnanh/webhook/issues/238#issuecomment-380742425, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AcgmezXjBeDgnzzGaOsebHbeS3YIxqihks5tnyFSgaJpZM4SYuzh
.

I would be interested in XML support but in mean time I can transform XML to JSON as needed.

Hello Adnan Hajdarević , Do you have timeline when webhook will pass the raw request payload???

Thanks
Osmar

My team would sincerely appreciate the ability to capture a raw payload without attempting to parse it.

I am working on a feature which would possibly allow you to do this. It involves writing a custom script which would accept raw payload, headers etc, and then output a json object which you would be able to access and pass down. You can try it out by compiling webhook from the feature/context-provider-command branch. There's no documentation at the moment, as I intend doing a RFC before pushing it out, but it works by specifying a "context-provider-command" field in the hook definition. The script will be passed an JSON string with an object containing various raw values. The output of the command has to be valid JSON string which will be parsed back by the webhook, and you can access those fields by specifying source as "context" instead of the usual "payload", "query", etc...

Was this page helpful?
0 / 5 - 0 ratings