Saving Gmail images to Google Drive

Hi all,

I’m building a workflow that regularly checks the inbox and pulls images (attached and in the message body) and save the to Google Drive. I’ve seen a few examples here, but they don’t seem to match the data I’m getting from the Gmail nodes.

I’m using a Gmail trigger that fires when a new emails arrive.

  1. When an image is placed into the body of the email, there’s an tag in the html body.
"html":"<div dir="ltr"><img src="data:image/jpeg;base64,/9j/4QDKRX....>"
  1. When the image is sent as an attachment, I find no references to the attachment at all.

  2. If I use a Gmail get:Thread Node, there are messages that have an attachmentId. But is there a Gmail Node to get attachments? Ex:
    GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}

I’m inclined to rely on the attachmentId presented by the thread, but can’t seem to find a Node to do that.

Does anyone have suggestions?

Information on your n8n setup

  • n8n version: Version 1.33.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Debian

hello @kimowasabiii

You have to disable the simplify switch and use Options – Download Attachments switch.

2 Likes

Thank you @barn4k , I can work with that!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.