Z-API WhatsApp icon

Z-API WhatsApp

Custom operations

Overview

This node enables interaction with the Z-API WhatsApp service to perform various messaging operations. Specifically, for the Message resource and the Pin / Unpin Messages operation, it allows users to pin or unpin a specific message in a WhatsApp chat or group. Pinning a message highlights it for a specified duration (24 hours, 7 days, or 30 days), making it easier to find important messages later.

Common scenarios where this node is beneficial include:

  • Highlighting critical announcements or updates in group chats.
  • Marking important customer support messages for quick reference.
  • Managing message visibility in active conversations by pinning/unpinning as needed.

Example use case:

  • Automatically pin a welcome message when a new user joins a group.
  • Unpin outdated promotional messages after their validity expires.

Properties

Name Meaning
Instance The unique identifier of your Z-API WhatsApp instance.
Token The API token used to authenticate requests to Z-API.
Client Token An additional client authentication token required by Z-API.
Phone The phone number or group ID where the message resides.
Message ID The unique identifier of the message to be pinned or unpinned.
Message Action Choose whether to "Pin" or "Unpin" the specified message.
Pin Message Duration Duration for which the message should remain pinned; options are "24 Hours", "7 Days", or "30 Days". This property is only applicable when pinning a message.

Output

The node outputs a JSON object representing the response from the Z-API service after attempting to pin or unpin the message. This typically includes status information about the success or failure of the operation.

No binary data output is produced by this operation.

Dependencies

  • Requires access to the Z-API WhatsApp service.
  • Needs valid credentials: an instance ID, an API token, and a client token from Z-API.
  • The node makes HTTP POST requests to the Z-API endpoint for pinning/unpinning messages.
  • Proper network connectivity to https://api.z-api.io is necessary.

Troubleshooting

  • Invalid Credentials: If the instance ID, token, or client token are incorrect or expired, the API will reject the request. Verify and update these credentials.
  • Incorrect Message ID or Phone Number: Providing an invalid message ID or phone/group ID will cause the operation to fail. Ensure these values correspond exactly to existing messages and chats.
  • Unsupported Operation Error: If the operation parameter is set incorrectly or not supported for the resource, the node throws an error indicating unsupported operation.
  • Network Issues: Connectivity problems to the Z-API endpoint can cause timeouts or failures. Check internet connection and firewall settings.
  • Pin Duration Misuse: The pin duration property is only valid when pinning a message. Attempting to set it while unpinning may be ignored or cause errors.

Links and References

Discussion