Create PDF from webhook JSON data

Hi there, I have a fairly simple Pipedream workflow that I am trying to configure.

The workflow is triggered when a response from Tally (tally.so) is recorded, and then inserts a new row into PostgreSQL. I am wanting to enhancve this workflow by creating a PDF from the JSON data received in the webhook. I have seen quite q few workarounds using custom code (XTOPDF for example with Python) but I haven’t managed to get it to work. I don’t want to use a PDF SaaS. Does anyone know how I can achieve this, perhaps with using the custom code module?

Thank you in advance.

Hi @sladerose1 ,

I’d be curious to hear if you find success with a 3rd party lib in Python or Node.js. Sometimes packages rely on binaries included in the package that aren’t supported in an ARM environment which your workflows are run in.

It’s kind of a hack, but you could use Google Docs as a free PDF exporter.

Make a new document containing your JSON, then use their PDF file type option when downloading the file from the API.

Hi Pierce, thanks for your reply. Yes, I did look at Google Docs first to see if I could import the JSON data into a Google Doc template and then export/attach the document as a PDF but I couldn’t figure it out. Basically what I need is: JSON data comes into the workflow via webhook > PDF generated from JSON data. How I make that happen with Pipedream (and without using an expensive PDF generation platform) I don’t know. I would obviously look at using a PDF SaaS tool but we currently received 70,000 responses a month and using a PDF SaaS is way out our budget for that.

Hi @sladerose1

Thanks for the details - a couple of options for you to try that might fit your budget constraints:

  1. Request to have pre-built actions built for downloading a Google Doc with a PDF download as an optional parameter
  2. Contact a Pipedream Partner to assist you with this workflow

Hi @pierce ,

I’m using the google drive http step. And I get a string output that seems to be correct.
Chatgpt tells me to use a --output “output.pdf” but I don’t know how to use it in pipedream nor in postman. I’ve never seen that parameter in a curl request.

I think that my best option is to just make a copy (or update de document) of the drive document into a pdf in the same folder and gather it in a next step. But I still need to get a valid pdf file to save into drive. How would you do it?

Now I’m trying the update_file
But updating the mime_type doesn’t do the work :frowning:

I can change the name of the document, but not the type

Sorry for the spam.

I did an export to tmp and then sent it to my google storage account. Worked fine. :slight_smile:

1 Like

Hi @tplagomarsino,

Could you share the code that you used to save the PDF file to /tmp please?

Thanks