Send Text
AI-generatedOverview
This node enables sending messages and managing communications via WhatsApp Web. It supports multiple operations including sending plain text messages, media files (images, videos, audio, documents), location coordinates, and replying to specific messages within a chat.
Common scenarios where this node is beneficial include:
- Automating customer support by sending notifications or replies through WhatsApp.
- Broadcasting updates or alerts with multimedia content.
- Sharing precise location information during logistics or event coordination.
- Engaging users interactively by replying to their messages programmatically.
For example, a business can use the "Send Text" operation to notify customers about order status, or use "Send Media" to share product images directly in WhatsApp chats.
Properties
| Name | Meaning |
|---|---|
| Chat ID | WhatsApp chat identifier: phone number with @c.us for individuals or group ID with @g.us for groups. |
| Message | The text message content to send (used only in "Send Text" operation). |
| Parse Mentions | Whether to parse and recognize @mentions in the text message (boolean, used in "Send Text"). |
| Connection Timeout (seconds) | Timeout duration in seconds to establish WhatsApp connection before failing (default 60 seconds). |
Output
The node outputs an array of JSON objects, each representing the result of processing one input item. For the "Send Text" operation, the output JSON includes:
operation: The performed operation name (sendText).chatId: The target WhatsApp chat ID.success: Boolean indicating if the message was sent successfully.messageId: The unique identifier of the sent message.timestamp: The timestamp when the message was sent.error: Error message string if sending failed; otherwise absent or null.
If the operation fails at connection or sending stage, success will be false and error will contain details.
The node does not output binary data for the "Send Text" operation.
Dependencies
- Requires an active WhatsApp Web session authenticated via a stored session name linked to the workflow.
- Uses the
whatsapp-web.jslibrary to interface with WhatsApp Web. - Puppeteer is used internally to control a headless browser instance for WhatsApp Web automation.
- Requires an API key credential configured in n8n for WhatsApp Web authentication.
- Temporary user data directories are created under
/tmp/whatsapp-web-<sessionName>-<workflowId>for session storage.
Troubleshooting
- Connection Timeout: If the node fails to connect within the specified timeout, it may indicate that the WhatsApp Web session needs re-authentication or the environment restricts Puppeteer execution. Increasing the timeout or verifying session validity can help.
- Authentication Failures: Errors related to authentication failure suggest invalid or expired session credentials. Re-authenticating the WhatsApp Web session is necessary.
- Session Lock Errors: Messages mentioning "SingletonLock" or "Failed to create a ProcessSingleton" indicate concurrent access issues or leftover session files. The node attempts cleanup but manual removal of session directories under
/tmpmight be required. - Invalid Chat ID: Providing an incorrect or malformed chat ID will cause message sending to fail. Ensure the chat ID format matches WhatsApp's requirements (
phone@c.usorgroup@g.us). - Message Sending Errors: Network issues or WhatsApp restrictions can cause failures. Review error messages returned in the output for specifics.
Links and References
- whatsapp-web.js GitHub repository
- Puppeteer documentation
- WhatsApp Web official client (used internally by the node)