Actions55
- Message Actions
- Contact Actions
- Chat Actions
- Group Actions
- Queue Actions
- Account Actions
- Session Actions
- Session Control Actions
- Call Actions
Contact → Block Contact
AI-generatedOverview
This node integrates with the Maytapi WhatsApp Unofficial API to manage WhatsApp contacts, specifically allowing users to block or unblock a contact. It is useful in scenarios where you want to programmatically control communication permissions with specific WhatsApp contacts, such as automatically blocking spam numbers or unblocking previously blocked contacts based on business logic.
For example, you can use this node to:
- Block a contact who sends unwanted messages.
- Unblock a contact after resolving an issue or upon user request.
The node requires specifying the contact's conversation ID and the desired action (block or unblock).
Properties
| Name | Meaning |
|---|---|
| Phone ID Source | Select how to provide the Phone ID: "From Credentials" uses the Phone ID stored in credentials; "Custom" allows entering a custom Phone ID manually. |
| Phone ID | The WhatsApp instance Phone ID to use when "Custom" is selected as Phone ID Source. Required if using custom source. |
| Conversation ID | The unique identifier of the contact's conversation, typically the phone number with @c.us suffix (e.g., 905301234567@c.us). Required. |
| Action | The action to perform on the contact: either "Block" or "Unblock". Required. |
Output
The node outputs JSON data representing the response from the Maytapi API for the block/unblock operation. This typically includes success status and any relevant message or error details returned by the API.
No binary data output is produced by this operation.
Example output JSON structure:
{
"success": true,
"message": "Contact blocked successfully"
}
or in case of failure:
{
"error": "Phone ID is required. Please provide it in credentials or select custom Phone ID."
}
Dependencies
- Requires an API key credential for the Maytapi WhatsApp API integration.
- The Phone ID must be provided either via credentials or manually as a custom value.
- The node makes HTTP requests to the Maytapi API endpoint
https://api.maytapi.com/api.
Troubleshooting
- Missing Phone ID: If neither credentials nor custom Phone ID is provided, the node throws an error: "Phone ID is required. Please provide it in credentials or select custom Phone ID." Ensure that the Phone ID is correctly set.
- Invalid Conversation ID: The conversation ID must be in the correct format (phone number with
@c.ussuffix). Incorrect formatting may cause API errors. - API Errors: Any errors returned by the Maytapi API will be passed through in the output JSON. Check the error message for details.
- Network Issues: Ensure that your n8n instance has internet access to reach the Maytapi API endpoint.
- Action Value: Only "block" or "unblock" are valid actions. Providing other values will result in an error.
Links and References
- Maytapi Official Website
- Maytapi WhatsApp API Documentation
- WhatsApp Contact Blocking Concept (for general understanding)