Skip to main content

Gmail Get Attachments

Controlled node

Overview

Fetches attachments from a Gmail message by its ID and saves them to the library. This node requires an active Gmail connection and a valid message ID to retrieve attachments. Each attachment is downloaded and stored as a file in the project's library, returning file metadata that can be used with other library nodes.

Connection Required

This node requires a Gmail connection to be configured in the project settings. The connection must have appropriate permissions to read email attachments.

Inputs

InputTypeDescriptionDefault
RunEventFires when the node starts running-
Message IDTextThe ID of the Gmail message to fetch attachments from-
ConnectionsConnectionThe Gmail connection to use for fetching attachments-

Outputs

OutputTypeDescription
AttachmentsDataArray of file objects containing the downloaded attachments. Each object includes id, name, mimeType, size, and dir properties. Returns an empty array if no attachments are found or if an error occurs.
DoneEventFires when the node has finished fetching attachments

Runtime Behavior and Defaults

  • The node requires both a valid project ID and Gmail connection to execute; otherwise, it returns an empty array
  • Attachments are automatically uploaded to the project's library with metadata preserved (filename, MIME type, size)
  • If the message contains no attachments, the output will be an empty array
  • On error (e.g., invalid message ID, connection issues), the node returns the error message as a string in the attachments output
  • The node processes all attachments in a single message in one execution

Example Usage

Basic Attachment Retrieval

Connect this node after a Gmail Get Inbox or Gmail Search Emails node to retrieve attachments from specific messages:

  1. Use Gmail Search Emails to find messages with attachments (e.g., using query has:attachment)
  2. Connect the messages output to a For Each node to iterate through results
  3. Connect the Gmail Get Attachments node to the loop, using {{element.id}} as the Message ID input
  4. Connect the attachments output to Write To Library or process files directly

Processing Attachments

After retrieving attachments, you can:

  • Use Read PDF or Read Docx nodes to extract text content from document attachments
  • Use AI Vision Write to analyze image attachments
  • Move files to specific folders using Move Library File based on sender or content type

Error Handling

Connect the attachments output to an If node to check if the result is an array (success) or string (error):

  • If attachments is an array: Process normally
  • If attachments is a string: Log the error message and continue workflow