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.
This node requires a Gmail connection to be configured in the project settings. The connection must have appropriate permissions to read email attachments.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Fires when the node starts running | - |
| Message ID | Text | The ID of the Gmail message to fetch attachments from | - |
| Connections | Connection | The Gmail connection to use for fetching attachments | - |
Outputs
| Output | Type | Description |
|---|---|---|
| Attachments | Data | Array 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. |
| Done | Event | Fires 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:
- Use Gmail Search Emails to find messages with attachments (e.g., using query
has:attachment) - Connect the
messagesoutput to a For Each node to iterate through results - Connect the Gmail Get Attachments node to the loop, using
{{element.id}}as the Message ID input - Connect the
attachmentsoutput 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
attachmentsis an array: Process normally - If
attachmentsis a string: Log the error message and continue workflow