WSAPI icon

WSAPI

Interact with WSAPI WhatsApp API

Overview

This node enables sending an image message via WhatsApp using the WSAPI WhatsApp API. It is designed to send images to individual contacts or groups by specifying their WhatsApp IDs. This functionality is useful in scenarios such as automated customer support, marketing campaigns, or sharing media content programmatically within WhatsApp conversations.

For example, a business could use this node to automatically send product images with captions to customers who request information, or to share event photos in group chats.

Properties

Name Meaning
To The recipient's WhatsApp ID. For individual contacts, this is the phone number with country code followed by @s.whatsapp.net (e.g., 1234567890@s.whatsapp.net). For groups, it is the group ID followed by @g.us.
Media URL A publicly accessible HTTP or HTTPS URL pointing directly to the image file to be sent. Supported formats include JPG and PNG.
Caption Optional text caption to accompany the image. Supports emojis and formatting.
Mentions (Advanced Option) Comma-separated list of phone numbers (without @) to mention/tag in the message.
Reply To Message ID (Advanced Option) The ID of an existing message to which this image message will reply.
Is Forwarded (Advanced Option) Boolean flag indicating if the message should be marked as forwarded.
View Once (Advanced Option) Boolean flag indicating if the image should be viewable only once before disappearing. Applicable only for image and video messages.

Output

The node outputs JSON data representing the result of the send image operation. This typically includes metadata about the sent message such as message ID, status, timestamps, and any relevant response from the WhatsApp API.

If the operation involves binary data (e.g., media files), the node would handle it accordingly, but in this case, since the media is referenced by URL, the output focuses on JSON metadata confirming the message delivery.

Dependencies

  • Requires an active connection to the WSAPI WhatsApp API service.
  • Needs an API key credential configured in n8n to authenticate requests.
  • The media URL must be publicly accessible over HTTP or HTTPS; private or protected URLs are not supported.
  • Proper WhatsApp contact or group IDs must be used to ensure message delivery.

Troubleshooting

  • Invalid Recipient ID: If the "To" field is incorrectly formatted or uses an invalid phone number/group ID, the API may reject the message. Ensure the format matches number@s.whatsapp.net for contacts or groupid@g.us for groups.
  • Media URL Issues: If the media URL is inaccessible, broken, or points to an unsupported format, the message will fail. Verify the URL is correct and publicly reachable.
  • Permission Errors: Missing or incorrect API credentials will cause authentication failures. Confirm that the API key is valid and properly set up in n8n.
  • Unsupported Media Format: Sending unsupported image formats may result in errors. Use JPG or PNG for images.
  • View Once Flag Misuse: Setting "View Once" on unsupported operations or media types may cause unexpected behavior. Only use it with images or videos.

Common error messages usually indicate these issues and can be resolved by verifying input parameters and credentials.

Links and References

Discussion