Green API icon

Green API

Send WhatsApp messages via Green API

Overview

This node enables sending WhatsApp messages and related actions via the Green API service. It supports various message types such as text, files by URL or upload, polls, locations, contacts, and forwarding existing messages. The node is useful for automating WhatsApp communications in workflows, such as sending notifications, sharing media, conducting polls, or managing group chats.

Practical examples include:

  • Sending a text alert to a customer.
  • Sharing an image or document from a URL or local file.
  • Forwarding important messages between chats.
  • Sending location details or contact cards.
  • Creating and sending interactive polls to groups or individuals.

Properties

Name Meaning
Chat ID Identifier of the chat to send the message to. For private chats use phone@c.us, for groups use chatId@g.us.
Message Text content of the message to send.
Quoted Message ID Optional ID of a message to quote (reply to) in the chat.

Additional properties relevant to the "Send" operation (not listed here but available in the node) include options for sending files, polls, locations, contacts, and forwarding messages, each with their own specific parameters.

Output

The node outputs a JSON array where each element corresponds to the response from the Green API for each input item processed. The JSON typically contains confirmation data about the sent message or action performed, such as message IDs or status information.

If sending files or other media, the output confirms successful transmission but does not output binary data directly.

Dependencies

  • Requires an active Green API account with valid credentials: an instance ID and an API token.
  • The node makes HTTP POST requests to Green API endpoints.
  • Requires n8n credentials configured with the necessary API authentication tokens.
  • For file uploads, access to the local filesystem or binary input data is needed.

Troubleshooting

  • Failed to send message/file/poll/etc.: Usually indicates network issues, invalid credentials, or incorrect parameters. Check the error message for details and verify all required fields are correctly set.
  • Failed to read file: When sending files by upload, ensure the specified file path is correct and accessible by n8n.
  • Invalid Chat ID format: Ensure chat IDs follow the required format (phone@c.us for private, chatId@g.us for groups).
  • Quoted Message ID errors: If quoting a message, verify the quoted message ID exists and belongs to the target chat.
  • API rate limits or permission errors: May occur if the Green API account has restrictions; check your account status and permissions.

Links and References

  • Green API Documentation
  • WhatsApp chat ID formats and usage guidelines (refer to Green API docs)
  • n8n documentation on creating custom nodes and using credentials

Discussion