Evolution API icon

Evolution API

Complete WhatsApp automation with Evolution API

Overview

The "Get Messages" operation of the Evolution API node allows you to retrieve messages from a specific WhatsApp chat by providing the phone number associated with that chat. This is useful for scenarios where you want to fetch recent conversation history, monitor incoming messages, or process chat data for analytics or automation workflows.

For example, you could use this operation to:

  • Automatically pull the last 50 messages from a customer support chat to analyze customer inquiries.
  • Integrate message retrieval into a CRM system to keep track of communication history.
  • Trigger further workflow steps based on the content of retrieved messages.

Properties

Name Meaning
Phone Number The target WhatsApp phone number including country code (without the "+" sign).
Additional Fields Optional extra parameters:
• Delay: Delay in milliseconds before sending (not used here).
• Link Preview: Enable link preview in messages (not used here).
• Quoted Message ID: ID of message to quote/reply to (not used here).
• Mentions: Comma-separated list of numbers to mention (not used here).
• Limit: Maximum number of messages to retrieve (defaults to 50 if not specified).

Note: Although the Additional Fields collection includes several options, for the "Get Messages" operation only the limit field is relevant and used to specify how many messages to fetch.

Output

The output JSON contains the response from the Evolution API endpoint /chat/findMessages/{instanceName}. It includes an array of messages matching the query criteria (messages from the chat identified by the phone number).

Typical structure of the output JSON:

{
  "messages": [
    {
      "id": "string",
      "from": "string",
      "to": "string",
      "timestamp": "string",
      "text": "string",
      "type": "string",
      // other message metadata fields...
    },
    ...
  ],
  "limit": 50,
  "count": "number_of_messages_returned"
}

The exact fields depend on the Evolution API's message schema but generally include message IDs, sender/receiver info, timestamps, and message content.

This node does not output binary data for this operation.

Dependencies

  • Requires an active Evolution API credential configured in n8n with:

    • Base URL of the Evolution API service.
    • API key for authentication.
    • Instance name identifying the WhatsApp instance.
  • Optionally uses a secondary API key credential for validating subscription via the N8N Tools API.

  • The node makes HTTP POST requests to the Evolution API endpoints.

Troubleshooting

  • Invalid Credentials or Subscription: If the node throws errors related to invalid API keys or subscription issues, verify that your Evolution API credentials and optional N8N Tools API keys are correct and active.

  • Unknown Operation or Resource Errors: These occur if the operation or resource parameter is set incorrectly. Ensure "Resource" is set to "Message" and "Operation" to "Get Messages".

  • API Request Failures: Network issues or incorrect instance names can cause request failures. Confirm the instance name matches your Evolution API setup and that the base URL is reachable.

  • Limit Parameter: If too many messages are requested, the API might reject the request or return partial results. Use reasonable limits (default is 50).

Links and References

Discussion