Overview
This node enables interaction with the Wuzapi WhatsApp API to perform various chat-related operations. Specifically, the "Download Media" operation allows users to download different types of media (image, video, audio, document) from WhatsApp messages by providing necessary metadata and encryption keys.
Common scenarios for this node include:
- Automatically retrieving media files sent in WhatsApp chats for processing or storage.
- Integrating WhatsApp media downloads into automated workflows, such as saving images or documents to cloud storage.
- Handling encrypted media by supplying required decryption keys and hashes.
For example, a user can configure the node to download an image from a message by specifying the media URL, encryption key, MIME type, and file hash details. The node will then fetch and decrypt the media, making it available as binary data for further use in the workflow.
Properties
| Name | Meaning |
|---|---|
| Media Type | Type of media to download. Options: Audio, Document, Image, Video |
| Media URL | URL of the media file to download (required) |
| Direct Path | Optional direct path to the media file |
| Media Key | Media encryption key used to decrypt the media (required) |
| Mime Type | MIME type of the media file (e.g., image/jpeg) (required) |
| File SHA256 | SHA256 hash of the original file for integrity verification (required) |
| File Length | Size of the file in bytes (required) |
| Additional Fields | Collection of optional fields: |
| - File Enc SHA256 | Encrypted file SHA256 hash |
| - Binary Property Name | Name of the binary property where the downloaded media will be stored (default: "data") |
Output
The node outputs the downloaded media as binary data attached to the item under a binary property. By default, this property is named "data" but can be customized via the "Binary Property Name" additional field.
The binary data includes:
data: Base64-encoded content of the downloaded media.mimeType: The MIME type of the media (e.g.,image/jpeg).fileExtension: File extension inferred from the MIME type (e.g.,jpg,mp4,ogg,pdf).fileName: A generated filename likedownloaded-media.jpg.
This structure allows subsequent nodes in the workflow to easily access and manipulate the media file.
Dependencies
- Requires connection to the Wuzapi WhatsApp API using an API key credential configured in n8n.
- The node depends on the external Wuzapi API endpoints for downloading media and requires valid media metadata and encryption keys to successfully retrieve and decrypt files.
Troubleshooting
- Invalid or missing media key: If the media encryption key is incorrect or missing, the download will fail or produce corrupted output. Ensure the correct key is provided.
- Incorrect file hashes: Providing wrong SHA256 hashes may cause integrity check failures or errors during decryption.
- Invalid URLs or paths: The media URL or direct path must be accessible and correctly formatted; otherwise, the request will fail.
- API authentication errors: Make sure the API key credential is properly set up and has permissions to access the required endpoints.
- Binary property conflicts: If multiple media downloads occur in one execution, ensure unique binary property names if needed to avoid overwriting data.
Error messages typically reflect HTTP request failures or validation errors from the API. Reviewing the error message and verifying all input parameters usually resolves issues.
Links and References
- Wuzapi WhatsApp API Documentation (for detailed API usage and media download requirements)
- n8n Documentation on Binary Data (to understand how binary data is handled in workflows)