Actions148
- Send messages Actions
- Outbound Messages Actions
- WhatsApp Numbers Actions
- Groups Actions
- Channels Actions
- Chats Actions
- Chat Contacts Actions
- Chat Messages Actions
- Chat Files Actions
- Team Actions
- Labels Actions
- Departments Actions
- Files Actions
- Quick replies Actions
- Queue Actions
- WhatsApp session Actions
- WhatsApp profile Actions
- Business catalog Actions
- Campaigns Actions
- Meeting Links Actions
- User Status Actions
- Webhooks Actions
- Other Actions
Chat Contacts → Get Contacts
AI-generatedOverview
The "Get Contacts" operation under the "Chat Contacts" resource in this node allows users to retrieve WhatsApp contacts associated with a specified WhatsApp number (device). It supports extensive filtering options to narrow down contacts by attributes such as name, type (personal, business, group, etc.), presence of email or chat, country, labels, metadata, creation and update dates, last message dates, pagination, and sorting.
This operation is beneficial for scenarios where you need to manage or analyze WhatsApp contacts programmatically, such as:
- Extracting a list of business contacts for targeted marketing campaigns.
- Filtering contacts by country or label to segment communication.
- Retrieving recently updated contacts for synchronization with other systems.
- Paginating through large contact lists efficiently.
Practical example: A user wants to fetch all personal contacts from a specific WhatsApp number that have an email address and were created after January 1, 2023, sorted by most recently updated. This operation can fulfill that request with the appropriate filters.
Properties
| Name | Meaning |
|---|---|
| WhatsApp Number | The ID of the WhatsApp number (device) whose contacts are to be retrieved. |
| Filters | A collection of optional filters to refine the contacts returned: |
| - Search | Search contacts by name, phone, email, etc. |
| - Contact Type | Filter contacts by type. Options: Personal, Business, User (both personal and business), Group, Channel, Private. |
| - Has | Filter contacts that have email, chat, or both. Options: Email, Chat. |
| - Has Chat | Deprecated boolean filter to include/exclude contacts with WhatsApp chat; use "Has" instead. |
| - Country | Filter contacts by country codes. Includes a comprehensive list of countries to select from. |
| - Labels | Filter contacts by chat labels. Supports multiple values and dynamic loading based on the device. Use "*" to include any labeled chat. |
| - Exclude Labels | Exclude contacts with specific labels. Supports multiple values and dynamic loading based on the device. Use "*" to exclude any labeled chat. |
| - Include Items | Specify related entities to include in the response. Currently supports including "chat". |
| - Metadata Key | Filter contacts containing specific metadata keys. Supports multiple values. |
| - Metadata Value | Filter contacts containing specific metadata values. Supports multiple values. |
| - Created After | Filter contacts created after this date/time. |
| - Created Before | Filter contacts created before this date/time. |
| - Updated After | Filter contacts updated after this date/time. |
| - Updated Before | Filter contacts updated before this date/time. |
| - Last Message After | Filter contacts with last message sent after this date/time. |
| - Last Message Before | Filter contacts with last message sent before this date/time. |
| - Results Page Size | Number of results per page (pagination). Default is 20. |
| - Page Number | Page number to retrieve, starting from 0. |
| - Sort | Sort order for results. Options: Name A-Z, Name Z-A, Recently Created, Oldest Created, Recently Updated, Oldest Updated. Default is Name A-Z. |
Output
The output is a JSON array where each item represents a contact matching the specified filters. Each contact object typically includes details such as contact identifiers, names, types, labels, metadata, timestamps for creation and updates, and possibly related chat information if requested via the "Include Items" property.
If binary data is included (not typical for this operation), it would represent associated files or media linked to contacts, but this operation primarily returns structured JSON data about contacts.
Dependencies
- Requires an API key credential for authenticating with the WaliChat WhatsApp API.
- The node depends on the WaliChat service being accessible and properly configured.
- Dynamic loading of options like devices and labels depends on the API responses.
- No additional environment variables are explicitly required beyond the API key credential.
Troubleshooting
Common Issues:
- Invalid or missing WhatsApp number (device) ID will cause the operation to fail.
- Using deprecated filters like "Has Chat" may not behave as expected; prefer using the "Has" filter.
- Pagination parameters out of range (e.g., negative page numbers) might result in empty responses or errors.
- Network or authentication issues with the WaliChat API will prevent contact retrieval.
Error Messages:
- Errors related to authentication usually indicate invalid or missing API credentials.
- Validation errors may occur if required properties like the WhatsApp number are not provided.
- API rate limits or service unavailability will manifest as HTTP errors; retry or check service status.
Resolution Tips:
- Ensure the WhatsApp number ID is correct and corresponds to an active device.
- Update filters to use current supported options.
- Verify API key validity and permissions.
- Check network connectivity and API endpoint accessibility.
Links and References
- WaliChat API Documentation (generic placeholder link)
- n8n Documentation on Creating Custom Nodes
- WhatsApp Business API Overview: https://developers.facebook.com/docs/whatsapp/overview/