Green API Get Document

Download and process WhatsApp documents via Green API

Overview

This node interacts with the Green API to download and process WhatsApp documents. It supports two main operations: obtaining the download URL for a document and downloading the actual document file. This node is useful for workflows that need to retrieve documents sent via WhatsApp, such as archiving files, processing attachments, or integrating WhatsApp documents into other systems.

Use Case Examples

  1. Automatically download and save WhatsApp documents received in a specific chat for record-keeping.
  2. Fetch the download URL of a WhatsApp document to share or process it externally before downloading.
  3. Convert downloaded WhatsApp documents into binary data for further processing or storage within n8n.

Properties

Name Meaning
Chat ID The WhatsApp chat ID where the document was sent, required to identify the source chat.
Message ID The ID of the specific document message to download, used to identify the exact document.
Save as Binary Determines whether the downloaded document file should be saved as binary data within the workflow.
Binary Property Name The name of the binary property where the document file will be stored if saving as binary is enabled.

Output

Binary

Contains the downloaded document file data encoded in base64 if 'Save as Binary' is enabled.

JSON

  • downloadUrl - The URL from which the document can be downloaded.
  • mimeType - The MIME type of the document file.
  • fileName - The name of the document file.
  • fileSize - The size of the downloaded document file in bytes (only present when the document is downloaded).
  • chatId - The WhatsApp chat ID where the document was sent.
  • messageId - The ID of the document message.
  • downloaded - Boolean indicating if the document was successfully downloaded (only present for the download operation).
  • error - Error message if the operation failed (only present if continueOnFail is enabled and an error occurred).

Dependencies

  • Requires Green API credentials including instance ID and API token for authentication.

Troubleshooting

  • If no download URL is received, ensure the chat ID and message ID are correct and the document exists.
  • Errors during download may be due to network issues or invalid credentials; verify API token and instance ID.
  • If the node fails and continueOnFail is disabled, the workflow will stop; enable continueOnFail to handle errors gracefully.

Links

  • Green API Documentation - Official documentation for Green API, useful for understanding API endpoints and authentication.

Discussion