Maytapi icon

Maytapi

Integrate with Maytapi WhatsApp Unofficial API

Message → Get Messages

AI-generated

Overview

This node integrates with the Maytapi WhatsApp Unofficial API to perform various WhatsApp-related operations. Specifically, for the Message resource and Get Messages operation, it retrieves messages from a specified WhatsApp conversation. This is useful for scenarios where you want to fetch chat history or monitor conversations programmatically.

Practical examples include:

  • Fetching recent messages from a customer support chat to analyze user queries.
  • Retrieving messages from a group conversation for logging or auditing purposes.
  • Filtering messages by author or fetching only your own sent messages in a conversation.

Properties

Name Meaning
Phone ID Source Select how to provide the Phone ID: either "From Credentials" (uses stored credentials) or "Custom" (enter manually).
Phone ID The WhatsApp instance Phone ID to use when "Custom" is selected as Phone ID Source. Required if custom.
Conversation ID The unique identifier of the WhatsApp conversation to retrieve messages from (e.g., 905301234567@c.us). Required.
Page Page number for pagination of messages. Optional; defaults to 0 (first page).
Count Number of most recent messages to retrieve. Optional; defaults to 20.
Author Filter messages to only those sent by a specific person in the conversation (optional).
From Me Only If true, only messages sent by your own WhatsApp account in the conversation will be retrieved. Optional; defaults to false.

Output

The output is an array of JSON objects representing the retrieved messages from the specified conversation. Each item corresponds to one message with all its details as returned by the Maytapi API.

  • The exact structure of each message depends on the WhatsApp message format provided by Maytapi, typically including fields like message ID, sender, timestamp, content, type, etc.
  • No binary data is output for this operation.

Example output snippet (simplified):

[
  {
    "id": "message_id_123",
    "author": "905301234567@c.us",
    "timestamp": 1680000000,
    "type": "text",
    "text": "Hello, how can I help you?"
  },
  {
    "id": "message_id_124",
    "author": "your_phone_number@c.us",
    "timestamp": 1680000050,
    "type": "image",
    "imageUrl": "https://example.com/image.jpg"
  }
]

Dependencies

  • Requires an API key credential for Maytapi WhatsApp API access.
  • The Phone ID must be provided either via credentials or manually as input.
  • The node makes HTTP requests to the Maytapi API endpoint https://api.maytapi.com/api.
  • Proper network connectivity and valid credentials are necessary.

Troubleshooting

  • Error: "Phone ID is required."
    Occurs if no Phone ID is provided either in credentials or as a custom input. Ensure you have set the Phone ID correctly.

  • Invalid Conversation ID
    If the conversation ID is incorrect or does not exist, the API may return an error or empty results. Verify the conversation ID format (usually phone number with suffix like @c.us).

  • Pagination issues
    If you request a page number beyond available pages, you might get empty results. Adjust the Page and Count parameters accordingly.

  • API errors or rate limits
    Maytapi API may return errors due to invalid tokens, expired credentials, or rate limiting. Check your API key validity and usage limits.

  • Filtering by Author or From Me Only returns no messages
    Make sure the author ID matches the expected format and that there are messages matching the filter criteria.

Links and References


If you need summaries for other resources or operations, feel free to ask!

Discussion