Green API Get Document
AI-generatedOverview
This node downloads and processes WhatsApp document messages via Green API. It supports multiple input sources for the document data, including message ID with chat ID, direct download URL, or data from a previous node. The node fetches the document file, applies optional filters like file type and maximum file size, and allows customization of the output filename. It outputs the document as binary data along with metadata if requested. This node is useful for workflows that need to retrieve and handle WhatsApp documents automatically, such as archiving files, processing attachments, or integrating WhatsApp documents into other systems.
Use Case Examples
- Download a document from a WhatsApp message using its message ID and chat ID, then save it with a custom filename.
- Fetch a document directly from a provided download URL and filter to only process PDF or image files.
- Retrieve document data from a previous node's output, include metadata, and limit the file size to 5 MB.
Properties
| Name | Meaning |
|---|---|
| Input Source | Source of the document message data, can be message ID, download URL, or previous node output. |
| Message ID | WhatsApp message ID containing the document, required if input source is messageId. |
| Chat ID | WhatsApp Chat ID where the message was sent, required if input source is messageId. |
| Download URL | Direct download URL for the document, required if input source is downloadUrl. |
| Message ID Field | Field name containing the message ID in previous node data, used if input source is previousNode. |
| Chat ID Field | Field name containing the chat ID in previous node data, used if input source is previousNode. |
| Download URL Field | Field name containing the download URL in previous node data, used if input source is previousNode. |
| Binary Property Name | Name of the binary property to store the document file. |
| Options | Additional options including whether to include metadata, custom filename, file type filter, and max file size. |
Output
Binary
The node outputs the downloaded document as binary data under a configurable property name (default 'document').
JSON
success- Indicates if the document was successfully downloaded and processed.fileName- The filename of the downloaded document, possibly customized.fileSize- Size of the downloaded file in bytes.mimeType- MIME type of the downloaded document.documentType- Human-readable document type based on file extension and MIME type.metadata- Optional metadata about the document such as message ID, chat ID, download URL, original filename, file size, MIME type, caption, and download timestamp.originalData- Original JSON data from the previous node if input source is 'previousNode' and metadata inclusion is enabled.
Dependencies
- Requires Green API credentials including instance ID and API token for authentication.
Troubleshooting
- Error 'No file URL found for message' indicates the message ID or chat ID might be incorrect or the message does not contain a downloadable document.
- File size errors occur if the downloaded file exceeds the configured maximum file size; increase the limit or skip large files.
- File type filtering may cause documents to be skipped if their extension or MIME type does not match the selected filters.
- Ensure the input source fields (message ID, chat ID, download URL) are correctly set and available in the input data when using 'previousNode' source.
Links
- Green API Documentation - Official documentation for Green API used to download WhatsApp documents.