Actions21
- Message Actions
- Group Actions
- Chat Actions
- Contact Actions
Overview
The "Get Contacts" operation of the Green API node retrieves a list of WhatsApp contacts or groups from the connected WhatsApp instance via the Green API service. This operation is useful for workflows that need to access and process contact information, such as syncing contacts with a CRM, filtering contacts for targeted messaging, or managing group memberships.
Typical use cases include:
- Fetching all contacts or only groups from a WhatsApp account.
- Limiting the number of contacts retrieved for performance or pagination.
- Integrating WhatsApp contact data into other systems or automations.
Properties
| Name | Meaning |
|---|---|
| Group Only | Boolean flag indicating whether to return only groups (true) or all contacts (false). |
| Count | Number specifying how many contacts to return. Use 0 to return all available contacts. |
Output
The output is a JSON array where each item contains the response from the Green API's getContacts endpoint. The structure typically includes details about contacts or groups such as their IDs, names, and possibly other metadata provided by the WhatsApp instance.
Example output structure (simplified):
[
{
"contacts": [
{
"id": "972501234567@c.us",
"name": "John Doe",
"isGroup": false,
...
},
{
"id": "120363369140947676@g.us",
"name": "Family Group",
"isGroup": true,
...
}
]
}
]
No binary data output is involved in this operation.
Dependencies
- Requires an active connection to the Green API WhatsApp service.
- Needs valid credentials including an instance ID and an API token for authentication.
- The node makes HTTP POST requests to the Green API endpoints.
- No additional environment variables are required beyond the configured credentials.
Troubleshooting
Common issues:
- Invalid or expired API credentials will cause authentication failures.
- Network connectivity problems can prevent successful API calls.
- Requesting too many contacts at once may lead to timeouts or rate limiting.
Error messages:
"Failed to get contacts: <error message>"indicates an issue during the API request. Check credentials and network status.- Errors related to JSON parsing or unexpected response formats suggest possible API changes or temporary service issues.
Resolutions:
- Verify and update API credentials if necessary.
- Ensure the Green API service is reachable from your n8n instance.
- Reduce the
Countparameter to a smaller number if large responses cause errors.
Links and References
- Green API Official Documentation — For detailed API usage and authentication setup.
- WhatsApp Business API Overview — Background on WhatsApp messaging capabilities.
- n8n Documentation — General guidance on using and configuring nodes in n8n.