Actions148
- Chats Actions
- Chat Contacts Actions
- Chat Messages Actions
- Chat Files Actions
- Files Actions
- Team Actions
- Labels Actions
- Departments 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
- Send messages Actions
- Outbound Messages Actions
- WhatsApp Numbers Actions
- Groups Actions
- Channels Actions
Overview
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 filtered list of contacts for marketing campaigns.
- Synchronizing contact data with CRM systems.
- Generating reports on contact types or activity.
- Managing contact groups or labels dynamically.
For example, you could use this node to fetch all business contacts from a specific country who have active chats, sorted by recently updated, to target them with personalized messages.
Properties
| Name | Meaning |
|---|---|
| WhatsApp Number | The ID of the WhatsApp number (device) whose contacts you want to retrieve. This is required. |
| Filters | A collection of optional filters to refine the contacts returned: |
| - Search | Search contacts by name, phone, email, or other text fields. |
| - Contact Type | Filter contacts by type. Options include: Personal, Business, User (both personal and business), Group, Channel, Private. |
| - Has | Filter contacts that have email, chat, or both. |
| - Has Chat | Deprecated boolean filter to include/exclude contacts with WhatsApp chat; replaced by has=chat. |
| - Country | Filter contacts by country codes. You can select one or multiple countries or choose "Any country". |
| - Labels | Filter contacts by chat labels. Supports multiple values. Use * to include any labeled chat. |
| - Exclude Labels | Exclude contacts with specific labels. Supports multiple values. Use * to exclude any labeled chat. |
| - Include Items | Specify related entities to include in the response. Currently supports including "Chat". |
| - Metadata Key | Filter contacts that have specific metadata keys. Supports multiple values. |
| - Metadata Value | Filter contacts that have 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 whose last message was sent after this date/time. |
| - Last Message Before | Filter contacts whose last message was sent before this date/time. |
| - Results Page Size | Number of results per page (pagination size). Default is 20. |
| - Page Number | Page number for paginated results, starting from 0. |
| - Sort | Sort order for results. Options include: Name A-Z, Name Z-A, Recently Created, Oldest Created, Recently Updated, Oldest Updated. Default is Name A-Z. |
Output
The output is an array of JSON objects representing the contacts retrieved based on the input parameters and filters. Each object corresponds to a contact and includes details such as contact identifiers, names, types, labels, metadata, timestamps (created, updated, last message), and possibly related chat information if requested via the "Include Items" property.
If binary data were involved (not indicated here), it would typically represent media files or attachments related to contacts, but this operation focuses on contact data only.
Dependencies
- Requires an API key credential for authenticating with the SparkBot WhatsApp API service.
- The node depends on the SparkBot API endpoints to fetch contact data.
- Proper configuration of the WhatsApp number (device) within the SparkBot system is necessary.
- The node uses dynamic loading methods to populate options like devices and labels, which depend on the connected account's data.
Troubleshooting
Common Issues:
- Invalid or missing WhatsApp number (device) ID will cause the operation to fail.
- Using deprecated filters like
hasChatinstead ofhas=chatmay lead to unexpected results. - Pagination parameters (
sizeandpage) must be valid numbers; otherwise, the API might reject the request. - Filtering by labels requires that labels exist and are accessible for the selected device.
- Date filters must be in proper ISO date-time format.
Error Messages:
- Authentication errors indicate issues with the provided API key credential; verify and reconfigure if needed.
- "Resource not found" or similar errors may mean the WhatsApp number or labels do not exist or are inaccessible.
- Validation errors on filters usually specify which parameter is invalid; check the input carefully.
Resolution Tips:
- Ensure the API key credential is correctly set up and has sufficient permissions.
- Verify the WhatsApp number ID by using the device selection dropdown or API calls.
- Use the latest filter options and avoid deprecated ones.
- Check date formats and ensure they conform to expected standards.
- If filtering by labels, confirm labels exist for the device.