Green API icon

Green API

Send WhatsApp messages via Green API or trigger workflows on webhooks

Overview

This node integrates with the Green API service to perform various WhatsApp-related actions, specifically for managing groups when the "Group" resource is selected. The "Set Group Picture" operation allows users to update the profile picture of a WhatsApp group by uploading a JPG image.

Typical use cases include:

  • Automating group management tasks such as updating group pictures based on events or schedules.
  • Integrating WhatsApp group updates into broader workflows, e.g., changing group images dynamically in response to marketing campaigns or announcements.

For example, a workflow could automatically update a group's picture to reflect a new event banner or seasonal theme by providing the path to a new JPG image file.

Properties

Name Meaning
Mode Selects the node mode: "Action" to execute WhatsApp actions or "Listen for Incoming Webhook" to trigger workflows on incoming webhooks.
Webhook Filters (Only in trigger mode) Filters to control which incoming webhook events trigger the workflow, including chat ID, chat type, message content, sender, and webhook type filters.
Group ID The unique identifier of the WhatsApp group to perform the action on (e.g., 972501234567-1587570015@g.us). Required for group operations.
Group Image Path to the JPG image file to set as the new group picture. This must be a valid local file path. Required for the "Set Group Picture" operation.

Output

The node outputs an array of JSON objects representing the response from the Green API after performing the requested operation. For the "Set Group Picture" operation, the output JSON typically contains confirmation details about the success or failure of setting the group picture.

If the operation involves sending or uploading files, the node handles binary data internally but outputs only JSON responses describing the result; it does not output binary data itself.

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 corresponding to the selected operation.
  • For file operations like setting the group picture, the node reads the specified JPG file from the local filesystem.
  • Node requires appropriate permissions to read local files specified in the "Group Image" property.
  • No additional external dependencies beyond standard Node.js modules (fs and path) used internally for file handling.

Troubleshooting

  • File Read Errors: If the node fails to read the JPG image file (e.g., due to incorrect path or insufficient permissions), it throws an error indicating the failure to read the file. Ensure the file path is correct and accessible by n8n.
  • API Request Failures: Errors returned from the Green API (e.g., invalid group ID, authentication issues) will cause the node to throw errors with messages from the API. Verify that the instance ID and API token are correct and that the group ID exists.
  • Mode Misconfiguration: Using this node configured as a trigger while attempting to perform actions will throw an error instructing to use it as a trigger node only or switch to action mode.
  • Invalid Property Values: Missing required properties like "Group ID" or "Group Image" will prevent execution. Make sure all required fields are filled correctly.

Links and References

Discussion