Skip to main content

I’m pulling a PDF from an external API using Webhooks by Zapier (GET). The request works (I can download and view the PDF outside Zapier), but the API returns the PDF base64-encoded inside JSON. I need to convert that base64 into a single file object I can attach in later steps (Google Drive upload / Gmail attachment), but I can’t get Zapier to expose it as one “file” field — it keeps showing separate fields (filename/mime/content) or plain text.

 

My goal is to convert the JSON response { status: 1, data: "<very long base64>" } into a proper file output  so downstream actions treat it as a file (I’ve read somewhere it shows as “Exists but not shown”).

 

Sample of the response headers: content-type: text/html; charset=UTF-8, content-encoding: gzip

 

What I’ve already tried:

  • Returning three top-level outputs (filename, mime_type, content), downstream apps see them as three separate text fields, not a file.

  • Wrapping under a single file key as { file: { filename, mime_type, content } } (JS) / {"file": {...}} (Python), still not consistently getting a single “file” output; sometimes I only see the pieces.

  • JSON.rawJSON(...) on the Code step output, no change.

  • I also tried cleaning the payload (trim everything before %PDF-), then re-encoding to base64.

Hi ​@apiering 

Have you tried asking ChatGPT for custom Code (JavaScript / Python) to handle that file conversion?

 

Code: https://zapier.com/apps/code/integrations#help


@apiering 

Have you tried using this Zap app: Base64 Encoder/Decoder

https://zapier.com/apps/base64-encoderdecoder/integrations

 


Hey ​@apiering, just checking in—were you able to get your Zap working by using the existing Base64 app as Troy suggested? 

Want to make sure this gets sorted, so let us know if you still need any help at all! 🙂


Reply