Overview
This node enables interaction with the DinastiAPI 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 and saving media files sent or received in WhatsApp chats.
- Integrating WhatsApp media downloads into automated workflows for processing or archiving.
- Handling encrypted media content by supplying required decryption keys and hashes.
For example, a user can input the URL and encryption key of an image sent via WhatsApp, and the node will download and decrypt the image, 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 be downloaded (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 JSON data representing the response from the DinastiAPI after the download request. If the media is successfully downloaded, the node adds the media content as binary data to the output item under the specified binary property name (default is data).
The binary data includes:
data: The base64-encoded media content.mimeType: The MIME type of the media.fileExtension: The file extension inferred from the MIME type (e.g., jpg, mp4, ogg).fileName: A generated filename likedownloaded-media.jpg.
This allows subsequent nodes in the workflow to access the media file directly for further processing, storage, or transmission.
Dependencies
- Requires an active connection to the DinastiAPI WhatsApp API service.
- Needs an API authentication token or API key credential configured in n8n to authorize requests.
- The node depends on the external DinastiAPI endpoints for downloading media and requires correct metadata and encryption keys to decrypt media files properly.
Troubleshooting
Common Issues:
- Incorrect or missing media encryption key (
mediaKey) will cause decryption failures. - Invalid or expired media URLs may result in download errors.
- Mismatched SHA256 hashes or file length values can lead to integrity check failures.
- Providing an incorrect MIME type might cause improper handling of the binary data.
- Incorrect or missing media encryption key (
Error Messages:
- Errors returned from the API typically indicate issues with authorization, invalid parameters, or media not found.
- Decryption or data parsing errors may occur if the media key or hashes are incorrect.
Resolutions:
- Verify that all required fields (
url,mediaKey,mimetype,fileSHA256,fileLength) are correctly set. - Ensure the API credentials are valid and have sufficient permissions.
- Confirm the media URL is accessible and not expired.
- Double-check the SHA256 hashes and file size match the actual media file.
- Verify that all required fields (
Links and References
- DinastiAPI WhatsApp API Documentation (example placeholder link)
- WhatsApp Media Encryption Overview
- n8n Documentation on Binary Data Handling