cancel
Showing results for 
Search instead for 
Did you mean: 

Serving files with workato?

matt-outen
Deputy Chef I
Deputy Chef I

Hi everyone, I'm trying to serve an xml file with a webhook. In simple terms, I'm trying to do this: "If you visit this webhook url, you should be served XML data". I'm starting to feel like it's not possible (at least using a webhook), but I'll lay out what I'm trying to do, and please let me know if you have any advice:


1. Webhook trigger on parent recipe

2. Call callable function

3. (on callable function) Using connection to Postgres, select rows using custom SQL

2. (on callable function)Take all of those rows in a "For Each (batch)" and create message using a template. The message I'm creating is a template to produce an XML file. Return "XML" back to parent recipe

3. Here's where I'm having issues. I can log the result using "Logs by Workato", and get some JSON back (example), but ideally I'd like to serve the actual XML (extracted from the object), as soon as a user hits the webhook. Do I need to use the API functionality instead? Thanks in advance for any advice.

1 REPLY 1

jblanchett
Deputy Chef III
Deputy Chef III

You can return XML back to the parent recipe I believe you just have to format it that way. Transform it from JSON to XML before you hand it back to the caller. Something like .to_xml may work. You may also have to choose a text response format instead of a JSON response format in the callabe recipe response schema config.