Green API icon

Green API

Send WhatsApp messages via Green API or trigger workflows on webhooks

Overview

This node enables sending WhatsApp messages and files via 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 for automating the distribution of images, documents, or other media without needing to upload the file manually.

Common scenarios include:

  • Automatically sending promotional images or brochures hosted on a website.
  • Sharing reports or documents stored on cloud storage via their URLs.
  • Distributing event invitations or multimedia content by linking to hosted files.

Example: Sending an image hosted at https://example.com/image.jpg with a caption to a WhatsApp group chat.

Properties

Name Meaning
Mode Operation mode: "Action" (execute WhatsApp actions) or "Listen for Incoming Webhook" (trigger).
Chat ID Identifier of the target chat. For private chats use phone number format like 972501234567@c.us. For groups use group ID like 972501234567-1581234048@g.us.
File URL Publicly accessible URL of the file to send.
File Name Name of the file as it will appear in the message (e.g., image.jpg).
Caption Optional text caption to accompany the file.
Quoted Message ID Optional ID of a message to quote in the reply.

Output

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

No binary data output is produced by this operation since the file is sent by URL reference.

Dependencies

  • Requires an active Green API account with valid credentials: instance ID and API token.
  • The node uses HTTP POST requests to Green API endpoints.
  • Network access to the file URL must be available from the environment where n8n runs.
  • No additional external dependencies beyond standard Node.js modules and n8n helpers.

Troubleshooting

  • Invalid Chat ID: Ensure the chat ID is correctly formatted for private or group chats.
  • File URL inaccessible: The URL must be publicly reachable; otherwise, the API will fail to fetch the file.
  • API authentication errors: Verify that the provided API credentials are correct and have necessary permissions.
  • Error messages: The node throws detailed errors including the API error message and the data sent, aiding diagnosis.
  • Network issues: Confirm that the n8n server can reach both the Green API endpoints and the file URL.

Links and References

  • Green API Documentation (for API endpoint details)
  • WhatsApp chat ID formats and usage guidelines (refer to WhatsApp official docs or Green API guides)

Discussion