Z-API WhatsApp icon

Z-API WhatsApp

Custom operations

Overview

This node integrates with the Z-API WhatsApp service to send various types of WhatsApp messages programmatically. Specifically, for the Message - Send Document operation, it allows users to send a document file (such as PDF, DOCX, etc.) to a specified phone number or group via WhatsApp.

Common scenarios where this node is beneficial include:

  • Automating the distribution of invoices, contracts, or reports directly through WhatsApp.
  • Sending user manuals or brochures to customers on demand.
  • Sharing official documents in customer support workflows.

For example, a business could automatically send a PDF invoice to a customer’s WhatsApp after a purchase is completed.

Properties

Name Meaning
Instance Your Z-API instance ID used to identify your WhatsApp API session.
Token Your Z-API token for authenticating API requests.
Client Token Your Z-API client token for additional authentication headers.
Phone The recipient's phone number or group ID where the document will be sent.
Document URL The publicly accessible URL of the document file to send (e.g., a PDF hosted online).
File Name The display name for the document file as it will appear in WhatsApp.
Extension The file extension/type of the document (e.g., pdf, docx).

Output

The node outputs a JSON object representing the response from the Z-API service after attempting to send the document. This typically includes status information about the message delivery, any error messages if applicable, and metadata returned by the API.

No binary data output is produced by this operation since the document is sent via a URL reference rather than uploading raw binary content.

Dependencies

  • Requires access to the Z-API WhatsApp service.
  • Needs valid credentials: an instance ID, a token, and a client token for authentication.
  • The document must be accessible via a public URL.
  • The node uses HTTP POST requests to the Z-API endpoints.
  • 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 will reject the request. Verify and update credentials accordingly.
  • Document URL Issues: The document URL must be publicly accessible without authentication. Private or inaccessible URLs will cause failures.
  • Unsupported File Extension: Ensure the file extension matches the actual document type and is supported by WhatsApp.
  • Phone Number Format: The phone number or group ID must be correctly formatted; otherwise, the message will not be delivered.
  • API Rate Limits: Excessive requests may trigger rate limiting by Z-API; consider adding delays or retries.
  • Error Messages: The node throws errors if the operation is unsupported or parameters are missing. Review error messages carefully to correct input parameters.

Links and References

Discussion