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, documents, images, audio, videos, stickers, GIFs, location data, contacts, polls, and event messages. The "Send Document" operation specifically allows users to send document files (e.g., PDFs) to a specified phone number via WhatsApp.

Common scenarios include automating customer support by sending invoices or contracts as documents, sharing reports, or delivering any file-based content directly through WhatsApp messaging.

Practical example: Automatically sending a PDF invoice to a customer's WhatsApp number after a purchase is completed in an e-commerce system.

Properties

Name Meaning
Instance ID Your Z-API Instance ID used for authenticating API requests.
Instance Token Your Z-API Instance Token (password field) for secure authentication.
Client Token Your Z-API Client Token (password field) for additional authentication.
Phone The recipient's phone number in international format (e.g., 5511999999999).
URL or Base64 The URL or base64 string of the document file to be sent.
Extension The file extension/type of the document (e.g., pdf).
Filename The name of the document file as it will appear to the recipient.
Caption Optional text caption accompanying the document message.
Additional Fields Collection of optional parameters:
- Delay Message: Seconds to wait before sending.
- Delay Typing: Seconds showing "Typing..." status before sending.
- Message ID to Reply: ID of a message to reply to.

Output

The node outputs a JSON array where each item corresponds to the response from the Z-API service for each input item processed. The structure depends on the API response but generally includes confirmation details about the sent message.

If the operation involves sending media (like documents), the output confirms successful transmission but does not output binary data itself.

Dependencies

  • Requires valid credentials for Z-API: Instance ID, Instance Token, and Client Token.
  • Needs network access to the Z-API endpoints.
  • No other external dependencies are required.
  • Proper configuration of these credentials within n8n or provided as node parameters is necessary.

Troubleshooting

  • Invalid Credentials: Errors related to authentication usually mean incorrect Instance ID, Instance Token, or Client Token. Verify and update credentials.
  • Unsupported Operation: If an unknown operation is selected, the node throws an error indicating the operation is not known. Ensure the operation matches supported ones like "send-document".
  • Missing Required Fields: For sending documents, missing phone number, URL/base64, extension, or filename will cause errors. Make sure all required fields are filled.
  • Network Issues: Failures connecting to Z-API may occur due to network problems or API downtime.
  • Message ID to Reply: If replying to a message, ensure the message ID exists and is valid; otherwise, the API may reject the request.

To resolve errors, check the error message details, verify inputs, and confirm API credentials and connectivity.

Links and References

Discussion