Green API icon

Green API

Send WhatsApp messages via Green API

Overview

This node enables sending WhatsApp messages through the Green API service. Specifically, the "Send File By URL" operation allows users to send a file directly from a publicly accessible URL to a specified WhatsApp chat. This is useful when you want to share images, documents, or other media hosted online without uploading them manually.

Common scenarios include:

  • Automatically sending promotional images or brochures hosted on your website.
  • Sharing reports or files stored in cloud storage via their URLs.
  • Distributing media content dynamically generated and accessible via URL.

Example: Sending an image located at https://example.com/image.jpg with a caption to a group chat identified by its chat ID.

Properties

Name Meaning
Chat ID The identifier of the WhatsApp chat to send the file to. For private chats use phone@c.us, for groups use chatId@g.us.
File URL The direct URL of the file to be sent. Must be publicly accessible.
File Name The name to assign to the file when sending (e.g., image.jpg).
Caption Optional text caption to accompany the file message.
Quoted Message ID Optional ID of a message to quote in the reply (used to reference a previous message).

Output

The node outputs a JSON array where each element corresponds to the response from the Green API after attempting to send the file. The JSON typically contains details about the sent message such as message ID, status, and any metadata returned by the API.

No binary data is output by this operation since the file is sent by URL rather than upload.

Dependencies

  • Requires an active Green API account with valid credentials (instance ID and API token).
  • The node uses HTTP POST requests to the Green API endpoints.
  • Network access to the file URL must be available from the n8n environment.
  • Proper configuration of the Green API credentials in n8n is necessary.

Troubleshooting

  • Failed to send file: This error may occur if the file URL is inaccessible, invalid, or the API credentials are incorrect. Verify the URL is reachable and credentials are correct.
  • Invalid Chat ID: Ensure the chat ID format matches WhatsApp requirements (phone@c.us for private, chatId@g.us for groups).
  • Quoted Message ID issues: If quoting a message, ensure the quoted message ID exists in the target chat.
  • Network errors: Confirm that the n8n instance has internet access and can reach both the Green API and the file URL.
  • API limits or restrictions: Check your Green API plan for any rate limits or restrictions on sending files.

Links and References

Discussion