Actions13
- Chatwoot Integration Actions
- Instance Actions
- Message Actions
- Parser Actions
- Webhook Actions
Overview
The "Download Media From WhatsApp" operation in the Instance resource is designed to extract and download media files (such as audio, video, images, or documents) from a complete WhatsApp message payload. This node automatically parses the WhatsApp message JSON payload to locate media information like URLs, media keys, direct paths, and mimetypes, then downloads the corresponding media content.
This operation is particularly useful when you receive WhatsApp messages containing media through webhooks or APIs and want to programmatically retrieve and process those media files within your n8n workflows. For example, you might use it to save voice notes, images, or documents sent via WhatsApp for archival, analysis, or forwarding purposes.
Practical examples include:
- Automatically downloading and storing images sent by customers in a support chat.
- Extracting audio messages for transcription or sentiment analysis.
- Retrieving documents shared over WhatsApp for automated processing.
Properties
| Name | Meaning |
|---|---|
| Input Source | Notice informing that this operation automatically extracts media data from the WhatsApp payload. Users should paste the complete WhatsApp message JSON payload here. |
| WhatsApp Payload | The full WhatsApp message payload in JSON format containing media information such as URLs, media keys, direct paths, and mimetypes. This is required input for the operation. |
| Advanced Overrides | Boolean flag indicating whether to manually override extracted media values instead of using those parsed from the payload. Useful for testing or special cases. |
| Media Key | (Optional) Manually override the extracted media key value. Only shown if Advanced Overrides is enabled. |
| Direct Path | (Optional) Manually override the extracted direct path value. Only shown if Advanced Overrides is enabled. |
| URL | (Optional) Manually override the extracted media URL. Only shown if Advanced Overrides is enabled. |
| Mimetype | (Optional) Manually override the extracted MIME type of the media. Only shown if Advanced Overrides is enabled. |
| Message Type | (Optional) Override the detected message type. Options are Audio, Video, Image, or Document. Only shown if Advanced Overrides is enabled. Defaults to Audio. |
Output
The node outputs JSON data representing the downloaded media content or metadata about the media file retrieved from WhatsApp. The exact structure depends on the implementation of the downloadMediaMessage function but typically includes:
- Media content or a reference to the downloaded file.
- Metadata such as filename, mimetype, size, or URLs used.
- Any relevant status or error information if the download fails.
If the node supports binary output, it would provide the media file's binary data for further workflow processing (e.g., saving to disk, uploading elsewhere). However, based on static analysis, the output focuses on JSON with media details.
Dependencies
- Requires access to the WhatsApp message payload containing media information.
- Likely depends on an API or service capable of downloading media from WhatsApp URLs using media keys and direct paths.
- No explicit external credentials are listed in the provided code snippet, but typically an API key or authentication token for the WhatsApp service or MegaAPI would be necessary.
- No environment variables or additional n8n configurations are explicitly mentioned for this operation.
Troubleshooting
Common Issues:
- Invalid or incomplete WhatsApp payload JSON may cause extraction failures.
- Missing media fields (like URL or mediaKey) in the payload will prevent successful download.
- Network issues or invalid URLs can cause download errors.
- Incorrect manual overrides may lead to failed downloads or wrong media retrieval.
Error Messages:
- Errors related to unknown operations or resources will not occur here since the operation is well-defined.
- If the node throws errors about missing parameters, ensure the WhatsApp payload is correctly pasted and contains valid media data.
- If download fails, verify network connectivity and validity of media URLs.
Resolutions:
- Validate the WhatsApp payload JSON before input.
- Use the Advanced Overrides only if you understand the media parameters.
- Check logs or enable detailed logging if available to diagnose download issues.
Links and References
- WhatsApp Business API Documentation
- MegaAPI WhatsApp Service (if publicly documented) (Note: link is generic as no specific docs were provided)
- n8n Documentation on Working with Binary Data
- General info on WhatsApp media message structure: Various developer forums and GitHub repos analyzing WhatsApp Web protocol.
This summary is based solely on static analysis of the provided source code and property definitions.