Actions6
- Send Message Actions
Overview
This node enables sending media messages via a WhatsApp communication API. It is designed to send various types of media content such as images, audio, video, documents, and WhatsApp-specific audio files directly to a recipient's phone number. The node supports additional features like setting message captions, specifying file names for base64-encoded files, and controlling presence status during message sending.
Common scenarios where this node is beneficial include:
- Automating customer support by sending product images or documents.
- Broadcasting multimedia promotional content.
- Sharing audio or video messages in marketing campaigns.
- Sending personalized media attachments in chatbots or notification systems.
Example: A business can use this node to automatically send an image catalog to customers who request it via WhatsApp, including a caption describing the products.
Properties
| Name | Meaning |
|---|---|
| Recipient | Phone number of the message recipient including country code (e.g., 5531900000000). |
| Delay | Optional delay in milliseconds before sending the message (e.g., 1200 ms). |
| Presence | Status to inform others about your presence while sending the message. Options: Available, Composing, Empty, Paused, Recording, Unavailable. |
| Media Type | Type of media to send. Options: Audio, Document, Image, Video, WhatsApp Audio. |
| File Name | Required filename for base64-encoded files (applicable for audio, document, image, video). |
| Caption | Text caption for the media message (applicable for image, document, video). |
| Media | URL or base64 string of the media content to be sent. |
Output
The node outputs JSON data representing the response from the WhatsApp API after attempting to send the media message. This typically includes confirmation details such as message ID, status, timestamps, or error information if the sending failed.
If binary data is involved (e.g., base64 media), it is handled internally but not outputted as binary data in the node’s output.
Dependencies
- Requires an API key credential for authenticating with the WhatsApp API service.
- Needs the base URL of the WhatsApp API instance configured in the node credentials.
- The node uses HTTP POST requests to send media messages to the endpoint
/message/sendMedia/{instanceName}/.
Troubleshooting
- Invalid Recipient Number: Ensure the phone number includes the correct country code and is formatted properly.
- Missing Required Fields: Media type, media content, and recipient are mandatory; missing these will cause errors.
- Incorrect Base64 Encoding: If sending base64 media, ensure the encoding is valid and the file name is provided.
- API Authentication Errors: Verify that the API key credential is correctly set up and has necessary permissions.
- Delay Misconfiguration: Delay should be a non-negative integer representing milliseconds; invalid values may cause unexpected behavior.
- Presence Option Issues: Use only the predefined presence statuses; unsupported values might be ignored or cause errors.
Common error messages usually relate to invalid input parameters or authentication failures. Checking the API response included in the node output helps diagnose issues.
Links and References
- WhatsApp Business API Documentation (general reference for media messaging concepts)
- n8n Documentation on Creating Custom Nodes and Using Credentials
- Base64 Encoding Guide for Media Files