Maytapi icon

Maytapi

Integrate with Maytapi WhatsApp Unofficial API

Chat → Clear Chat

AI-generated

Overview

The node integrates with the Maytapi WhatsApp Unofficial API to perform various WhatsApp-related actions. Specifically, for the Chat resource and Clear Chat operation, it allows users to clear the chat history of a specified conversation (either individual or group chat) on their WhatsApp instance.

This operation is useful when you want to programmatically delete all messages in a chat without deleting the chat itself. For example, businesses can use this to clear old customer conversations after a support ticket is closed, maintaining privacy and freeing up space.

Properties

Name Meaning
Phone ID Source Select how to provide the Phone ID: either "From Credentials" (use Phone ID stored in credentials) or "Custom" (enter a custom Phone ID).
Phone ID The WhatsApp instance Phone ID to use. Required if "Phone ID Source" is set to "Custom".
Conversation ID The unique identifier of the conversation whose chat history will be cleared. Format examples: user chat 905301234567@c.us or group chat 905301234567-1234567890@g.us.

Output

The output JSON contains the response from the Maytapi API after attempting to clear the chat. It typically includes success status and any relevant message or error details returned by the API.

No binary data is output for this operation.

Example output JSON structure:

{
  "success": true,
  "message": "Chat cleared successfully"
}

Dependencies

  • Requires an active Maytapi WhatsApp API account with valid API credentials.
  • The node needs an API key credential configured in n8n to authenticate requests.
  • The Phone ID must be provided either via credentials or as a custom input.
  • Internet access to https://api.maytapi.com/api is required.

Troubleshooting

  • Missing Phone ID Error: If neither credentials nor custom Phone ID is provided, the node throws an error stating "Phone ID is required." Ensure that the Phone ID is correctly set in credentials or entered manually.
  • Invalid Conversation ID: Providing an incorrectly formatted conversation ID may cause the API to fail. Use the correct format for user chats (phone@c.us) or groups (phone-groupid@g.us).
  • API Errors: Any errors returned by the Maytapi API (e.g., authentication failure, rate limits) will be passed through in the output JSON. Check your API key validity and usage limits.
  • Network Issues: Ensure the server running n8n has network connectivity to the Maytapi API endpoint.

Links and References

Discussion