WaliChat icon

WaliChat

Interact with WaliChat WhatsApp API

Actions148

Chat Messages → Get Messages

AI-generated

Overview

The "Get Messages" operation under the "Chat Messages" resource in this node allows users to retrieve WhatsApp chat messages from a specified WhatsApp number (device). It supports extensive filtering options such as message direction (inbound/outbound), delivery status, message types, date ranges, and more. This operation is useful for scenarios like monitoring conversations, analyzing message history, or syncing messages for further processing.

Practical examples include:

  • Fetching all inbound text messages received by a specific WhatsApp number within the last week.
  • Retrieving messages filtered by delivery status to identify failed or pending messages.
  • Searching messages containing specific keywords or media filenames.
  • Paginating through large volumes of chat messages with sorting and page size controls.

Properties

Name Meaning
WhatsApp Number The ID of the WhatsApp number (device) from which to fetch 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 multiple WhatsApp message IDs (WID).
- Search Search messages by text content, contact name, or media filename.
- Chat ID Filter messages by chat WhatsApp ID (can be 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 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 Sync Messages is true).

Output

The output is an array of JSON objects representing the retrieved WhatsApp chat messages matching the specified filters. Each message object may include:

  • Core message details such as message ID, sender, recipient, timestamp, message type, content, and delivery status.
  • Optionally included nested related documents depending on the "Include" filter settings, such as contact information, chat metadata, and media attachments.
  • If binary data (e.g., media files) is included, it will be represented accordingly but the node primarily outputs structured JSON data describing the messages.

Dependencies

  • Requires an API key credential for authenticating with the WaliChat WhatsApp API service.
  • The node depends on the external WaliChat API to fetch WhatsApp messages.
  • Proper configuration of the WhatsApp number (device) in the WaliChat system is necessary.
  • Network connectivity to the WaliChat API endpoint is required.

Troubleshooting

  • No messages returned: Verify that the WhatsApp number (device) is correct and active. Check filter criteria to ensure they are not too restrictive.
  • Authentication errors: Ensure the API key credential is valid and has appropriate permissions.
  • Rate limiting or API errors: The WaliChat API may impose limits; handle errors gracefully and consider retry logic.
  • Sync flag usage: When using the "Sync Messages" option, skipping messages without proper pagination might cause unexpected results.
  • Date filters: Ensure date/time values are correctly formatted and logical (e.g., "Created After" is before "Created Before").

Links and References

  • WaliChat Official API Documentation (example placeholder)
  • WhatsApp Business API concepts for message types and statuses
  • n8n documentation on creating custom nodes and handling pagination/filtering

Discussion