MegaAPI icon

MegaAPI

Interact with MegaAPI WhatsApp service - send messages, manage instance, configure webhooks

Overview

This node operation "Send Media From Chatwoot" allows sending media messages (images, audio, video, documents) via WhatsApp using the MegaAPI WhatsApp service. It supports two modes:

  • Automatic extraction from Chatwoot payload: The node extracts recipient, media URL, file name, media type, MIME type, and optional caption directly from a Chatwoot webhook payload containing message attachments.
  • Manual input mode: Users can manually specify all required details such as recipient phone number, media URL, file name, media type, MIME type, and caption.

This flexibility makes it useful for automating WhatsApp media messaging workflows integrated with Chatwoot conversations or for sending media messages based on custom inputs.

Practical examples:

  • Automatically forwarding media attachments received in Chatwoot conversations to WhatsApp contacts.
  • Sending promotional images or documents to customers by specifying URLs and metadata manually.
  • Integrating WhatsApp media messaging into customer support automation flows where media files are sent dynamically.

Properties

Name Meaning
Input Source Notice explaining that this operation can use Chatwoot payload with attachments or manual input.
Use Manual Input Boolean flag to choose between extracting data automatically from Chatwoot payload (false) or providing manual input (true).
To Recipient phone number in WhatsApp format (e.g., 5511999999999@s.whatsapp.net). Required when using manual input.
Media URL URL of the media file to send. Required when using manual input.
File Name Name of the media file (e.g., image.jpg). Required when using manual input.
Media Type Type of media to send. Options: Image, Audio, Video, Document. Required when using manual input.
Caption Optional caption text to accompany the media message.
MimeType MIME type of the media file (e.g., image/jpeg, audio/mpeg, video/mp4). Required when using manual input.
Override To Overrides the recipient phone number extracted from the Chatwoot payload if provided. Leave empty to use the original payload value.
Override URL Overrides the media URL extracted from the Chatwoot payload if provided. Leave empty to use the original payload value.
Override Caption Overrides the media caption extracted from the Chatwoot payload if provided. Leave empty to use the original payload value.
Override Type Overrides the media type extracted from the Chatwoot payload if provided. Options: Image, Audio, Video, Document. Default is Image.
Override File Name Overrides the file name derived from the URL or payload. Leave empty to derive from URL or payload.
Override MimeType Overrides the MIME type extracted from the Chatwoot payload if provided. Leave empty to use the original payload value.

Output

The node outputs JSON data representing the result of the media message sending operation. This typically includes confirmation of the message sent, any IDs or status returned by the MegaAPI WhatsApp service, and error information if applicable.

If the operation succeeds, the output JSON will contain details about the sent media message, such as message ID or status.

No binary data output is produced by this operation.


Dependencies

  • Requires an active MegaAPI WhatsApp service integration configured in n8n.
  • Needs valid API credentials or authentication tokens for MegaAPI to send WhatsApp messages.
  • For automatic extraction mode, expects a valid Chatwoot webhook payload containing message attachments.
  • Network access to the media URLs specified must be available for the MegaAPI service to fetch the media.

Troubleshooting

  • Invalid recipient format: Ensure the "To" phone number is in the correct WhatsApp format (e.g., 5511999999999@s.whatsapp.net).
  • Missing required fields: When using manual input, all required fields like To, Media URL, File Name, Media Type, and MimeType must be provided.
  • Incorrect MIME type: Provide accurate MIME types matching the media content to avoid message rejection.
  • Payload parsing errors: If using automatic extraction, ensure the Chatwoot payload JSON is complete and correctly formatted with attachments.
  • Network issues: The media URL must be publicly accessible; otherwise, the MegaAPI service cannot download the media.
  • API errors: Check MegaAPI service logs or responses for specific error messages related to authentication, rate limits, or invalid requests.

Links and References

Discussion