Z-API icon

Z-API

Send messages

Overview

This node integrates with the Z-API service to send various types of WhatsApp messages programmatically. It supports sending text, media (images, audio, video, documents, stickers, GIFs, PTV), location data, contacts, polls, and event messages. The "Send PTV" operation specifically allows sending PTV (possibly a type of video or media format supported by WhatsApp) messages to a specified phone number.

Common scenarios include automating customer notifications, marketing campaigns, alerts, or any workflow requiring WhatsApp messaging without manual intervention. For example, a business could automatically send a promotional video (PTV) to customers who opt in via a form.

Properties

Name Meaning
Instance ID Your Z-API Instance ID used for authentication with the Z-API service.
Instance Token Your Z-API Instance Token (password field) for secure API access.
Client Token Your Z-API Client Token (password field) for additional API authentication.
Phone The recipient's phone number in international format (e.g., 5511999999999). Required field.
URL or Base64 The media content to send, either as a direct URL or base64 encoded string. Required field.
Additional Fields Optional parameters including:
- Delay Message: seconds to wait before sending message (1-15).
- Delay Typing: seconds to show "Typing..." status before sending (0-15).
- Message ID to Reply: ID of a message to reply to.

Output

The node outputs an array of JSON objects corresponding to each input item processed. Each object contains the response from the Z-API service after attempting to send the message. This typically includes confirmation details such as message IDs or status indicators.

If an error occurs and "Continue On Fail" is enabled, the output will contain an object with an error property describing the failure.

No binary data output is produced by this node.

Dependencies

  • Requires valid credentials for the Z-API service: Instance ID, Instance Token, and Client Token.
  • Needs network access to the Z-API endpoints.
  • No additional environment variables are required beyond these credentials.

Troubleshooting

  • Common Issues:

    • Invalid or missing credentials will cause authentication failures.
    • Incorrect phone number formatting may result in message delivery errors.
    • Unsupported operations or resources will throw errors indicating unknown operation/resource.
    • Media URLs must be accessible and properly formatted; invalid URLs or corrupted base64 strings can cause failures.
  • Error Messages:

    • "The operation \"send-ptv\" is not known!": Indicates the operation parameter was incorrect or unsupported.
    • "The resource \"send-message\" is not known!": Indicates the resource parameter was incorrect or unsupported.
    • Network or API errors will return messages from the Z-API service; ensure credentials and network connectivity are correct.
  • Resolution Tips:

    • Double-check all credential values.
    • Validate phone numbers follow the expected international format.
    • Verify media URLs are publicly accessible or base64 strings are correctly encoded.
    • Use the "Additional Fields" to manage timing and replies carefully to avoid unexpected behavior.

Links and References

Discussion