WSAPI icon

WSAPI

Interact with WSAPI WhatsApp API

Overview

The node integrates with the WSAPI WhatsApp API to send various types of WhatsApp messages. Specifically, for the Message > Send Document operation, it allows sending a document file to a specified WhatsApp contact or group by providing a publicly accessible URL to the document.

This node is useful in scenarios where automated workflows need to share documents via WhatsApp, such as sending invoices, contracts, reports, or any PDF/office files directly to customers or team groups.

Example use cases:

  • Automatically sending a PDF invoice to a customer after an order is processed.
  • Sharing a contract document with a client upon signing.
  • Distributing meeting notes or presentations to a project group.

Properties

Name Meaning
To The WhatsApp ID of the recipient. For individual contacts, this is the phone number with country code (no plus sign) followed by @s.whatsapp.net (e.g., 1234567890@s.whatsapp.net). For groups, use the group ID followed by @g.us. This identifies who will receive the document.
Media URL The direct HTTP or HTTPS URL of the document file to send. Must be publicly accessible. Supported formats depend on WhatsApp but typically include PDFs, DOCX, XLSX, etc.
Caption Optional text caption to accompany the document. Supports emojis and formatting. Useful for adding context or instructions related to the document.
Advanced Options Additional optional settings:
- Mentions: Comma-separated list of phone numbers (without @) to mention in the message.
- Reply To Message ID: ID of a message to reply to.
- Is Forwarded: Boolean flag indicating if the message is forwarded.
- View Once: (Not applicable for documents; only for images/videos.)

Output

The node outputs JSON data representing the result of the send document operation. This typically includes metadata about the sent message such as message ID, status, timestamps, and any server response confirming delivery or errors.

If the operation succeeds, the output JSON confirms the message was sent and may contain identifiers useful for tracking or replying to the message later.

No binary data output is expected from this operation since it sends media by URL rather than uploading files directly.

Dependencies

  • Requires an active connection to the WSAPI WhatsApp API service.
  • Needs an API key credential configured in n8n to authenticate requests.
  • The provided media URL must be publicly accessible over HTTP or HTTPS without authentication.
  • Proper WhatsApp IDs (contacts or groups) must be used in the "To" field.

Troubleshooting

  • Invalid recipient ID: Ensure the "To" property uses the correct format (phone@s.whatsapp.net for contacts, group@g.us for groups). Missing country codes or incorrect suffixes will cause errors.
  • Media URL inaccessible: The document URL must be publicly reachable. Private URLs or those behind authentication will fail.
  • Unsupported document format: Verify that the document format is supported by WhatsApp. Unsupported formats may cause the message to not send.
  • API authentication errors: Check that the API key credential is valid and has proper permissions.
  • Error messages from WSAPI: These usually indicate issues like rate limits, invalid parameters, or server errors. Review the error message details and adjust inputs accordingly.

Links and References

Discussion