Actions21
- Message Actions
- Group Actions
- Chat Actions
- Contact Actions
Overview
This node integrates with the Green API service to send WhatsApp messages and perform related messaging operations. Specifically, the "Send File By Upload" operation under the "Message" resource allows users to send a file directly by uploading it from their local system to a specified WhatsApp chat. This is useful when you want to share images, documents, or other files in a WhatsApp conversation without relying on external URLs.
Common scenarios include:
- Sending invoices, reports, or PDFs directly to clients via WhatsApp.
- Sharing images or media files stored locally on your server or computer.
- Automating file sharing workflows where files are generated or downloaded and then sent through WhatsApp.
Example: You have a PDF report saved locally at C:/reports/monthly.pdf and want to send it to a client’s WhatsApp number with an optional caption describing the file.
Properties
| Name | Meaning |
|---|---|
| File Path | The full path to the file on your local system that you want to upload and send. |
| Caption | Optional text caption to accompany the file when sending it via WhatsApp. |
Output
The node outputs a JSON array containing the response from the Green API for each item processed. The response typically includes details about the message sent, such as message ID, status, and any metadata returned by the API.
If the operation involves sending a file by upload, the output confirms whether the file was successfully sent and may include identifiers or status codes from the WhatsApp message.
No binary data is output by this node; it only returns JSON responses from the API.
Dependencies
- Requires an active Green API account with valid credentials (instance ID and API token).
- The node uses these credentials to authenticate requests to the Green API endpoints.
- The local file system must be accessible to the node runtime to read the file specified by the "File Path".
- Node.js
fsmodule is used internally to read files. - Network access to
https://api.green-api.comis required.
Troubleshooting
- Failed to read file: If the node cannot find or access the file at the given path, it will throw an error. Ensure the file path is correct and accessible by the n8n process.
- API request failures: Errors like "Failed to send file by upload" indicate issues communicating with the Green API. Check your credentials, network connectivity, and API limits.
- Invalid chat ID: Make sure the chat ID is correctly formatted (e.g.,
972501234567@c.usfor private chats). - Missing required parameters: The "File Path" is mandatory. Omitting it will cause errors.
- Large files: Very large files might fail due to API or network limitations. Check Green API documentation for size limits.
Links and References
- Green API Documentation – Official API docs for message sending and file uploads.
- WhatsApp Chat IDs Format – Guidance on formatting chat IDs for WhatsApp.
- n8n Documentation – For general usage of custom nodes and credentials setup.