Skip to main content

Hi there

I have an app running on AWS which uploads exported data files to an s3 bucket. The files include a .json file with client data and .pdf file. I want to use ‘files added to s3’ as my trigger then I need a way to open the .json file, likey with a python code step. 

The data/file will then be used in further steps and will ultimately trigger transactional emails within a CRM.

 

.json file updated to S3 bucket
.json file contains data I need parsed via python code step.

 I found this article opening a text file, however it did not work for me. https://stackoverflow.com/questions/45404000/read-text-file-content-with-python-at-zapier

Please help me, as I am unsure how to approach this!

Joe

From what I can see, the tricky part here getting the contents of the file in a way that the Python can parse it.

It’s not currently possible to view a file’s contents when you uploaded it so S3, you can only get a link for the file. This is a feature request that we have open, but right now it’s not something that we can do because the S3 API doesn’t allow this. I’ve added you to the feature request in case that’s something that changes in the future; we’ll send you an email if we’re able to add the ability to get the contents of the file. 

 

I’m sorry that I can’t be of more help!


Hi @Danvers 

Thanks for coming back to me. Just wondering if it is possible to GET the object from the S3 and send elsewhere? - I can’t see a GET object as an available S3 zap action but wonder if it may be possible with webhooks given the object name will be known? 

Or is the Zapier S3 integration many for uploads and not object downloads?

Many thanks

Joe


import json
import requests

asset_url = input_data['file']
r = requests.get(url=asset_url)

if r.ok:
    output = =r.json()]
else:
    output = t{"error": r.content}]