Z-API icon

Z-API

Send messages

Overview

This node integrates with the Z-API service to send various types of messages via WhatsApp. It is designed to automate message sending workflows, allowing users to send text messages, multimedia content, location data, contacts, polls, and more directly from n8n.

A common use case is automating customer notifications, alerts, or marketing messages through WhatsApp by specifying the recipient's phone number and message content. For example, a business can automatically send order confirmations or appointment reminders as WhatsApp messages.

Specifically, the Send Text operation under the Send Message resource allows sending plain text messages or editing existing messages by providing a message ID to update.

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). Required.
Text The text content of the message to be sent. Required.
Message ID to Edit Optional ID of an existing message to edit with new text content instead of sending a new one.
Additional Fields Optional extra parameters:
- Delay Message Delay in seconds (1-15) before sending the message.
- Delay Typing Delay in seconds (0-15) showing "Typing..." status before sending the message.
- Message ID to Reply ID of the message to which this message should reply.

Output

The node outputs a JSON array where each element corresponds to the response from the Z-API service for each input item processed. The structure of each JSON object depends on the Z-API response but generally includes details about the sent message such as message ID, status, and any metadata returned by the API.

No binary data output is produced by this operation.

Dependencies

  • Requires access to the Z-API service.
  • Requires three credentials for authentication: Instance ID, Instance Token, and Client Token.
  • No additional environment variables or external dependencies are needed beyond these credentials.
  • The node uses an internal helper function to make HTTP requests to the Z-API endpoints.

Troubleshooting

  • Common Issues:

    • Invalid or missing credentials will cause authentication failures.
    • Incorrect phone number format may result in message delivery errors.
    • Providing an unknown operation or resource name will throw an error.
    • Editing a message with an invalid or non-existent message ID will fail.
  • Error Messages:

    • "The operation \"send-text\" is not known!" — Occurs if an unsupported operation is specified; verify the operation name.
    • "The resource \"send-message\" is not known!" — Occurs if an unsupported resource is specified; verify the resource name.
    • API errors from Z-API (e.g., authentication failure, invalid phone number) will be returned in the node output or cause execution to stop unless "Continue On Fail" is enabled.
  • Resolutions:

    • Double-check all credential values.
    • Ensure phone numbers are in the correct international format without spaces or special characters.
    • Use only supported operations and resources as defined.
    • Enable "Continue On Fail" to handle individual item errors gracefully.

Links and References

Discussion