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
This node interacts with the SparkBot WhatsApp API to retrieve chat information associated with a specified WhatsApp number. The "Get Chats" operation under the "Chats" resource allows users to fetch lists of chats filtered and sorted by various criteria such as status, unread messages, chat type, assigned agents, labels, and more.
Practical scenarios where this node is beneficial include:
- Customer support teams wanting to monitor active or unresolved chats.
- Marketing teams filtering chats by labels or assigned agents for targeted campaigns.
- Operations teams retrieving chats that can receive messages to automate follow-ups.
- Analytics teams extracting chat data with related messages, notes, or participants for reporting.
Properties
| Name | Meaning |
|---|---|
| WhatsApp Number | The ID of the WhatsApp number (device) from which to retrieve chats. This identifies the specific WhatsApp account. |
| Filters | A collection of optional filters to narrow down the chats returned: |
| - Status | Filter chats by their status. Options: Pending, Active, Resolved, Archived, Muted. |
| - Unread Only | If true, only chats with unread messages are returned. |
| - Active Chats Only | If true, only active chats/groups/channels are included. |
| - Can Send Messages | If true, only chats that can receive messages are included. |
| - Read-Only Chats | If true, only read-only chats that cannot accept messages are included. |
| - Chat Type | Filter chats by type. Options: Chat, Group, Channel, Community. |
| - Assigned Agent IDs | Filter chats assigned to specific agents by their IDs. Multiple values allowed. |
| - Search Term | Text search to match phone numbers, names, etc., within chats. |
| - Labels | Filter chats by labels. Multiple values allowed. Use * to include any labeled chat. |
| - Exclude Labels | Exclude chats with specific labels. Multiple values allowed. Use * to exclude any labeled chat. |
| - Include Items | Specify related data to include in the response. Options: Messages, Notes, Participants. |
| - 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: Most Recent First, Oldest First, Unread First, Name A-Z, Name Z-A. |
Output
The output is an array of JSON objects representing chats matching the specified filters and pagination. Each chat object may include:
- Basic chat details such as chat ID, name, status, type, unread count, assigned agents, labels, and timestamps.
- Optionally included related data depending on the "Include Items" property:
- Messages: List of messages in the chat.
- Notes: Notes attached to the chat.
- Participants: Participants involved in the chat.
If binary data were involved (e.g., files), it would be summarized accordingly, but this operation focuses on JSON chat data.
Dependencies
- Requires an API key credential for authenticating with the SparkBot WhatsApp API.
- The node depends on the SparkBot API endpoints for chats.
- Load options for properties like WhatsApp numbers, agents, and labels depend on additional API calls to populate dropdowns dynamically.
- No other external services are explicitly required.
Troubleshooting
Common Issues:
- Invalid or missing WhatsApp number ID: Ensure the device ID corresponds to an active WhatsApp number linked to your account.
- Incorrect filter values: Verify that multi-select filters use valid options and that dependent load options have been loaded correctly.
- Pagination errors: Page numbers start at 0; requesting pages beyond available data will return empty results.
- API authentication failures: Confirm that the API key credential is valid and has necessary permissions.
Error Messages:
- Errors returned from the API will be surfaced in the node output if "Continue On Fail" is enabled.
- Common error messages relate to invalid parameters, unauthorized access, or rate limits.
- To resolve, check credentials, parameter correctness, and API usage limits.
Links and References
- SparkBot WhatsApp API Documentation (general reference for API capabilities)
- n8n documentation on Creating Custom Nodes
- n8n documentation on Handling Credentials
This summary is based solely on static analysis of the provided source code and property definitions without runtime execution.