Skip to main content
Best answer

How do you read file attachments in Gmail?


particlepat

I want to create a zap to read .json files sent via email and create a summary of them using ChatGPT. Ideally my flow will look like this:

  1. Gmail email received with label “Bug Report”
  2. ChatGPT parses unstructured data from the email (username, summary, etc)
  3. ChatGPT reads contents of stacktrace.json attachment and gathers the “root cause message”
  4. All data sent to a Google Sheet

Steps 1, 2 and 4 are pretty simple, but I can’t figure out the best way to get the email attachment into ChatGPT. Any ideas for how to approach this one?

Best answer by Troy TessaloneBest answer by Troy Tessalone

Hi @particlepat 

Good question.

Try these Zap steps...

  1. Trigger: Gmail - New Attachment
  2. Action: Webhook - GET
    1. Map configure the URL as shown below
    2. Leave everything else as is
    3. This will return the JSON contents already parsed

 

EXAMPLE OUTPUT

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30982 replies
  • Answer
  • August 15, 2023

Hi @particlepat 

Good question.

Try these Zap steps...

  1. Trigger: Gmail - New Attachment
  2. Action: Webhook - GET
    1. Map configure the URL as shown below
    2. Leave everything else as is
    3. This will return the JSON contents already parsed

 

EXAMPLE OUTPUT

 


particlepat
  • Author
  • Beginner
  • 4 replies
  • August 15, 2023

Thanks Troy this worked great for me. Quick follow up if you have time, what if you have up to two attachments. Sometimes the json is attachment 1 and other times it’s attachment 2. I can create a path to look for when json exists in either attachment, but then I basically have duplicate zaps for each path. Curious if there’s a better way to handle that.


Troy Tessalone
Forum|alt.badge.img+14

@particlepat

I meant to say use this Zap trigger: Gmail - New Attachment

 

You can add a Filter after step 1 to only process files with the desired conditions.


particlepat
  • Author
  • Beginner
  • 4 replies
  • August 16, 2023

Oops I missed that step one. This all worked perfect fro me! Thank you.