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, the "Get Labels" operation retrieves all labels (tags) associated with chats in a given WhatsApp instance. This is useful for organizing and managing conversations by categorizing them with tags.

Common scenarios include:

  • Fetching all available chat labels to display or use in automation workflows.
  • Synchronizing label data from WhatsApp to other systems.
  • Using labels to filter or segment messages for targeted processing.

Example: A user wants to list all tags applied to chats in their WhatsApp business account to decide which conversations need follow-up.

Properties

Name Meaning
Instance Your Z-API instance ID identifying the WhatsApp session to interact with.
Token Your Z-API token used for authenticating API requests.
Client Token Your Z-API client token used as an additional authentication header for API requests.

Output

The output JSON contains the response from the Z-API endpoint that lists all chat labels (tags). Typically, this will be an array of label objects, each representing a tag with its properties such as name or ID.

No binary data is returned by this operation.

Example output structure (simplified):

[
  {
    "id": "label1",
    "name": "Support"
  },
  {
    "id": "label2",
    "name": "Sales"
  }
]

Dependencies

  • Requires access to the Z-API WhatsApp service.
  • Needs valid credentials: instance ID, token, and client token.
  • The node makes HTTP GET requests to the Z-API endpoint https://api.z-api.io/instances/{instance}/token/{token}/tags.
  • No additional environment variables are required beyond the provided credentials.

Troubleshooting

  • Invalid Credentials: If the instance ID, token, or client token are incorrect or expired, the API call will fail. Verify and update credentials.
  • Network Issues: Connectivity problems can cause request failures. Ensure the server running n8n has internet access.
  • Unsupported Operation Error: If the resource or operation parameters are misconfigured, the node throws an error indicating unsupported operation. Double-check that "Resource" is set to "Message" and "Operation" to "Get Labels".
  • Empty Response: If no labels exist, the output may be an empty array. Confirm labels exist in the WhatsApp account.

Links and References

Discussion