I’m stuck trying to figure out how to pass XML content through Zapier to an external service.
Basically what I need to do is take incoming data from Facebook leads and convert it to XML format, then push that XML to a specific API endpoint I have.
I already have the target URL and I know exactly what the XML structure should look like, but I can’t seem to find the right way to set this up in Zapier. I’ve been looking through all the available actions and webhooks but nothing seems to handle XML posting directly.
Has anyone managed to get something like this working? What approach did you use to send properly formatted XML data from Zapier to an external system?
Any help would be really appreciated since I’m pretty much out of ideas at this point.
try using Webhooks in Zapier. set the method to POST and make sure to add application/xml in the content-type header. format ur XML in a code step first like return {xml: '<lead><name>' + inputData.name + '</name></lead>'} then send that in the webhook body.
Been working with XML workflows for years - everyone suggesting code steps is overcomplicating this.
Zapier makes you write JavaScript to build XML strings, then cross your fingers that escaping works. When special characters break everything, you’re stuck debugging. Every XML structure change means more code maintenance.
I moved our Facebook lead processing to Latenode after hitting the same issues. It handles XML natively - just drag Facebook fields to XML elements. No code needed. Formatting and escaping happens automatically.
Their HTTP connector sends XML to any endpoint with proper headers. No wrestling with webhooks or content types.
Saved me hours of XML debugging headaches. Way cleaner than JavaScript string hacks in Zapier.
you could also use zapier’s formatter step b4 the webhook. use text > extract pattern to clean up the fb data first, then add another formatter for custom transformation to build ur basic xml structure. it’s not as flexible as code steps, but way simpler for basic xml formatting if u want to avoid js headaches.
I solved this same issue six months ago when connecting Facebook leads to our CRM’s XML API. The webhook method works, but watch out for XML formatting in your code step. I built a JavaScript code step using template literals to create the full XML structure, then validated it before sending. Special characters kept breaking my XML at first - you’ve got to escape user input properly. Here’s what saved me: test your XML formation extensively in the code step first. I used console.log() to check the generated XML against my target schema. Some APIs are finicky about XML declarations and encoding attributes, so add those if your endpoint needs them. Once your XML is formatted correctly in the code step, the webhook POST with content-type as application/xml handles delivery fine.
Yeah, this totally works with Zapier’s Code step plus HTTP POST. I did something similar sending leads to an old service that needed exact XML formatting. Build your XML dynamically in JavaScript using the Facebook fields as variables. Something like const xmlData = '<?xml version="1.0" encoding="UTF-8"?><lead><firstName>' + inputData.first_name + '</firstName><email>' + inputData.email + '</email></lead>'; then return it. Next, use a POST webhook to your API endpoint. Set content type to application/xml and map your code step’s XML output to the request body. Just watch out for null values in your JavaScript or you’ll break the XML tags.
Hit the same problem a few months ago trying to push data from multiple sources to legacy systems that only took XML.
Zapier sucks for XML workflows. You’re constantly wrestling with code steps and formatters, and it turns into a mess fast.
Switching to Latenode saved my sanity. It handles XML manipulation beautifully - pull your Facebook leads, transform them into whatever XML structure you need with their visual editor, then push straight to your API.
Best part? No custom code needed for XML formatting. Their built-in XML nodes let you map Facebook lead fields directly to XML elements. Ten minutes to set up what would be pure hell in Zapier.
I use it for all complex data transformations now. Way more reliable than hacking together XML in Zapier code steps.