WhatsApp Web Send icon

WhatsApp Web Send

Send messages, media, and manage WhatsApp Web communications

Send Media

AI-generated

Overview

This node enables sending various types of messages through WhatsApp Web, including text messages, media files (images, videos, audio, documents), location coordinates, and replies to specific messages. It is useful for automating WhatsApp communications in workflows, such as sending notifications, sharing media content, or replying to customer inquiries.

Practical examples:

  • Sending an image with a caption to a group chat.
  • Sharing a location pin during a delivery update.
  • Replying to a customer's previous message with additional information.
  • Broadcasting audio clips or documents to multiple contacts.

Properties

Name Meaning
Chat ID WhatsApp chat identifier: phone number with @c.us for individuals or group ID with @g.us.
Media Type Type of media to send. Options: Image, Video, Audio, Document.
Media URL URL of the media file to be sent. Must be accessible publicly or within network reach.
Caption Optional text caption accompanying the media file.
Connection Timeout (seconds) Time in seconds to wait for WhatsApp connection before timing out (default is 60 seconds).

Output

The node outputs a JSON object per input item with the following fields:

  • operation: The operation performed (e.g., "sendMedia").
  • chatId: The target WhatsApp chat ID.
  • success: Boolean indicating if the message was sent successfully.
  • messageId: The unique identifier of the sent message (if successful).
  • timestamp: Timestamp when the message was sent.
  • error: Error message if the operation failed.

No binary data output is produced by this node.

Dependencies

  • Requires an active WhatsApp Web session authenticated via an API key credential configured in n8n.
  • Uses the whatsapp-web.js library internally to interact with WhatsApp Web.
  • Puppeteer is used under the hood to automate browser interactions.
  • Temporary user data directories are created under /tmp/whatsapp-web-<sessionName>-<workflowId> for session management.
  • Network access to the media URLs provided is necessary for sending media files.

Troubleshooting

  • Connection Timeout: If the node fails to connect within the specified timeout, it may indicate that the WhatsApp session needs re-authentication or there are network issues. Increasing the timeout or re-establishing credentials can help.
  • Authentication Failures: Errors related to authentication usually mean the stored WhatsApp session is invalid or expired. Re-authenticate the WhatsApp Web session credential.
  • Media URL Issues: Ensure the media URL is accessible and points directly to a valid media file. Unsupported or inaccessible URLs will cause sending failures.
  • Session Directory Errors: Errors mentioning profile directory or singleton lock suggest concurrent sessions or corrupted session data. Cleaning up temporary session directories or restarting the workflow environment may resolve these.
  • Unknown Operation: If an unsupported operation is selected, the node throws an error. Verify the operation property is set correctly.

Links and References

Discussion