Actions29
- Chat Actions
- Group Actions
- Instance Actions
- Message Actions
- Webhook Actions
Overview
This node operation sends a media file from a specified URL to a WhatsApp contact using the MegaAPI WhatsApp service. It downloads the media from the provided URL and sends it as the chosen media type (e.g., audio, document, image, video, or voice message) to the target WhatsApp contact.
Common scenarios where this node is useful include:
- Automatically sending invoices, PDFs, or documents hosted online to customers.
- Sharing images or videos stored on external servers with WhatsApp contacts.
- Delivering audio files or voice messages via WhatsApp without manual upload.
- Sending promotional materials or reports directly through WhatsApp by referencing their URLs.
Practical example:
- A business wants to send a PDF brochure hosted on their website to a customer’s WhatsApp number automatically after a form submission.
- A support team shares a video tutorial hosted on a CDN link with a client via WhatsApp.
Properties
| Name | Meaning |
|---|---|
| To (Contact) | The WhatsApp contact to send the media to. Must be in the format phone_number@s.whatsapp.net (e.g., 5511999999999@s.whatsapp.net). |
| Media URL | The direct URL of the media file to be sent. The file will be downloaded from this URL before sending. |
| File Name | The name that the file will have when received in WhatsApp (e.g., example.pdf). |
| Media Type | The type of media being sent. Options: Audio, Document, Image, PTT (voice message), Video. |
| MIME Type | The MIME type of the media file. Options include common formats like PDF, JPEG, MP4, OGG audio, Excel, Word, SQL, generic binary, etc. |
| Caption | Optional text caption to accompany the media file in the WhatsApp message. |
| Information | Informational notice explaining that the node sends a media file from a URL to the specified WhatsApp contact by downloading it first. |
Output
The node outputs JSON data representing the result of the send operation for each input item. This typically includes confirmation details such as message IDs or status returned by the MegaAPI WhatsApp service.
If the node supports binary data output (not explicitly shown here), it would represent media content or related binary responses, but in this case, the focus is on sending media rather than receiving it.
Dependencies
- Requires an active MegaAPI WhatsApp service account with valid API credentials (host URL and authentication token).
- The node uses these credentials to authenticate requests to the MegaAPI endpoint.
- Network access to download the media file from the provided URL is necessary.
- Proper configuration of the API key/token in n8n credentials is required.
Troubleshooting
- Invalid Contact Format: Ensure the "To (Contact)" property follows the exact format
phone_number@s.whatsapp.net. Missing or incorrect formatting will cause errors. - Media URL Accessibility: The URL must be publicly accessible and allow direct download. Private or protected URLs may cause failures.
- Unsupported MIME Type: Selecting a MIME type that does not match the actual media file can lead to delivery issues or errors.
- File Name Required: Omitting the file name or providing invalid characters might cause the message to fail.
- API Authentication Errors: Invalid or expired API tokens will prevent sending messages. Verify credentials are correct and active.
- Network Issues: If the node cannot reach the media URL or the MegaAPI service, it will throw errors. Check network connectivity and firewall settings.
- Error Messages: The node throws descriptive errors indicating unknown operations or resources if misconfigured. Double-check resource and operation selections.
Links and References
- WhatsApp Media Message Guidelines
- MegaAPI WhatsApp Service Documentation (generic placeholder, replace with actual if available)
- MIME Types Reference