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 Messages" operation under the "Chat Messages" resource allows users to retrieve WhatsApp chat messages from a specified WhatsApp number (device). This node is useful for scenarios where you want to analyze, archive, or process WhatsApp conversations programmatically. For example, businesses can use it to fetch customer support chat histories, monitor message delivery statuses, or filter messages by type or date for reporting purposes.
Practical examples include:
- Fetching all inbound text messages received after a certain date.
- Retrieving media messages (images, videos) sent in a specific group chat.
- Filtering messages by delivery status such as only those that failed to send.
- Paginating through large volumes of chat messages with sorting options.
Properties
| Name | Meaning |
|---|---|
| WhatsApp Number | The ID of the WhatsApp number (device) from which to retrieve messages. |
| Filters | A collection of optional filters to narrow down the messages returned: |
| - Flow | Filter messages by direction: Inbound or Outbound. |
| - Delivery Status | Filter messages by delivery acknowledgment status: Pending, Sent, Delivered, Read, Failed. |
| - WhatsApp IDs | Filter messages by one or more WhatsApp message IDs (WID). |
| - Search | Search messages by text content, contact name, or media filename. |
| - Chat ID | Filter messages by the WhatsApp ID of the chat (user, group, or channel). |
| - From | Return messages sent from a given phone number or WhatsApp WID. |
| - To | Return messages received to a given phone number or WhatsApp WID. |
| - Chat Type | Filter messages by chat type: Chat, Group, Channel, Community. |
| - Reference | Filter messages by an exact match on the reference field. |
| - Message Type | Filter messages by type: Text, Image, Audio, Voice, Video, Document, Contact, Location, System. |
| - Sync Messages | Boolean flag indicating whether to sync messages from the WhatsApp session if no messages are available locally. |
| - Begin From Message ID | Return newest messages starting from the given message ID. |
| - End At Message ID | Return oldest messages starting from the given message ID. |
| - Created After | Return messages created after the specified date/time. |
| - Created Before | Return messages created before the specified date/time. |
| - Include | Include nested related documents per message: Contact, Chat, Media. |
| - Sort | Sort messages by date: Recent First or Oldest First. |
| - Results Page Size | Number of results to return per page. |
| - Page Number | Page number to return (starting from 0). |
| - Skip Messages | Number of previous messages to skip (only applicable if syncing messages). |
Output
The output is a JSON array where each item represents a chat message matching the specified filters. Each message object may include:
- Core message details such as message ID, timestamp, sender and receiver info, message content, and message type.
- Delivery status and metadata.
- Optionally included nested objects depending on the "Include" property:
- Contact information related to the message.
- Chat details (e.g., group or channel info).
- Media metadata if the message contains media attachments.
If binary data is involved (e.g., media files), it would be represented accordingly, but this operation primarily returns structured JSON data about messages.
Dependencies
- Requires an API key credential for authenticating with the SparkBot WhatsApp API service.
- The node depends on the external SparkBot WhatsApp API to fetch messages.
- Proper configuration of the WhatsApp number (device) within the connected account is necessary.
- The node uses internal methods to load options dynamically for devices and groups.
Troubleshooting
- No messages returned: Ensure the correct WhatsApp number (device) is selected and that messages exist for the applied filters. If using sync, verify the WhatsApp session is active.
- Authentication errors: Confirm that the API key credential is valid and has sufficient permissions.
- Invalid filter values: Check that filter values like message IDs, dates, and chat IDs are correctly formatted.
- Pagination issues: When paginating, ensure page numbers and sizes are set appropriately; zero-based indexing applies.
- Timeouts or slow responses: Large queries with many filters or large page sizes may cause delays; try reducing page size or narrowing filters.
Links and References
- SparkBot WhatsApp API Documentation
- WhatsApp Business API Concepts
- n8n Documentation on Creating Custom Nodes