WSAPI Message

Send and manage WhatsApp messages via WSAPI

Overview

This node enables sending WhatsApp messages through the WSAPI service, specifically supporting a variety of message types including text, links, images, videos, audio, voice notes, documents, contacts, locations, stickers, reactions, and message management actions (edit, delete, star, mark as read).

For the Send Document operation, the node sends a document file to a specified WhatsApp recipient or group. The document can be provided either as a URL or as Base64-encoded data. Additional options include specifying the filename, an optional caption, and advanced messaging features such as mentions, replying to a specific message, and marking the message as forwarded.

Common scenarios:

  • Sending invoices, contracts, or reports as PDF documents to clients.
  • Sharing presentations or spreadsheets with team members via WhatsApp groups.
  • Distributing brochures or manuals directly through WhatsApp chats.

Practical example:
You want to send a PDF contract to a client’s WhatsApp number. You provide the client's WhatsApp ID, the URL of the PDF document, specify the filename as "contract.pdf", and optionally add a caption like "Please review the attached contract."


Properties

Name Meaning
Recipient WhatsApp ID of the recipient (phone number with @s.whatsapp.net for contacts, or group ID with @g.us for groups)
Document Source Source of the document; options are: URL (link to the document) or Base64 (Base64 encoded document data)
Document URL URL of the document to send (required if Document Source is URL)
Document Base64 Base64 encoded document data (required if Document Source is Base64)
File Name Name of the document file (e.g., document.pdf)
Document Caption Optional caption text to accompany the document
Advanced Options Collection of additional options:
- Mentions Comma-separated list of WhatsApp IDs to mention in the message (referenced in text as @1234567890@s.whatsapp.net)
- Reply To Message ID ID of the message this document message is replying to
- Is Forwarded Boolean flag to mark the message as forwarded

Output

The node outputs the JSON response returned by the WSAPI service after sending the document message. This typically includes details about the sent message such as message ID, status, timestamps, and any metadata returned by the API.

No binary data output is produced by this operation.


Dependencies

  • Requires connection to the WSAPI WhatsApp messaging service.
  • Needs an API key credential and instance identifier configured in n8n credentials for authentication.
  • The node makes HTTP POST requests to the WSAPI endpoints to send messages.

Troubleshooting

  • Invalid recipient ID: Ensure the recipient WhatsApp ID is correctly formatted with @s.whatsapp.net for individual contacts or @g.us for groups.
  • Document not sent: Verify that the document URL is accessible and publicly reachable if using URL source, or that the Base64 string is correctly encoded.
  • Missing required fields: The node requires to, fileName, and depending on source, either documentURL or documentBase64. Missing these will cause errors.
  • Authentication errors: Confirm that the API key and instance ID credentials are valid and have proper permissions.
  • API request failures: Network issues or WSAPI service downtime may cause request failures; check connectivity and WSAPI status.

Links and References

Discussion