Z-API WhatsApp icon

Z-API WhatsApp

Custom operations

Overview

This node integrates with the Z-API WhatsApp service to perform various messaging-related operations. Specifically, for the Message resource and Add Label operation, it allows users to add a label (tag) to a WhatsApp chat identified by a phone number or group ID. This is useful for organizing chats, categorizing conversations, or marking important contacts within WhatsApp.

Practical scenarios include:

  • Automatically tagging customer support chats as "important" or "follow-up" based on incoming messages.
  • Organizing marketing campaign recipients by adding labels like "promo" or "VIP".
  • Managing group chats by labeling them for easier filtering and retrieval.

Properties

Name Meaning
Instance Your Z-API instance ID, identifying your specific WhatsApp API instance.
Token Your Z-API token used for authenticating API requests.
Client Token Your Z-API client token, an additional authentication header required by the API.
Phone The phone number or group ID of the chat to which the label will be added.
Tag The label/tag name to add to the specified chat (e.g., "important", "support", etc.).

Output

The node outputs the JSON response returned by the Z-API endpoint after attempting to add the label. This typically includes status information about the success or failure of the operation.

The output structure is a JSON object reflecting the API's response, which may contain fields such as confirmation of the tag addition or error details if the operation failed.

No binary data is produced by this operation.

Dependencies

  • Requires access to the Z-API WhatsApp service.
  • Needs valid credentials: an instance ID, a token, and a client token for authentication.
  • The node makes HTTP PUT requests to the Z-API endpoints.
  • Ensure that the n8n environment has internet access to reach https://api.z-api.io.

Troubleshooting

  • Common issues:

    • Invalid or expired tokens leading to authentication errors.
    • Incorrect phone number or group ID format causing the API to reject the request.
    • Network connectivity problems preventing communication with the Z-API service.
  • Error messages:

    • Authentication failures usually indicate invalid tokens; verify and update credentials.
    • "The operation 'add-label' is not supported for resource 'messages'" indicates a misconfiguration in the node parameters.
    • API errors returned from Z-API will be included in the node output; check these for specific causes.
  • Resolution tips:

    • Double-check all credential values and ensure they are current.
    • Validate the phone number or group ID format matches what Z-API expects.
    • Use the node’s "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion