Description
n8n-nodes-whatsapp-multi-session
This is an n8n community node for integrating with WhatsApp Multi-Session API. It allows you to send WhatsApp messages, manage sessions, and interact with contacts directly from your n8n workflows.
Features
- 📱 Session Management: Create, connect, disconnect, and manage WhatsApp sessions
- 💬 Message Operations: Send, forward, and reply to messages (text, images, documents, locations)
- 👥 Contact Management: List contacts and check if numbers are on WhatsApp
- ⌨️ Typing Indicators: Show/hide typing status for better user experience
- 🔗 Webhook Support: Receive real-time message notifications
- 📨 Webhook Trigger: Dedicated trigger node for receiving incoming WhatsApp messages
- 🔐 API Key Authentication: Secure authentication with API keys
Installation
Community Nodes (Recommended)
1. Go to Settings → Community Nodes in your n8n instance
2. Click Install a community node
3. Enter: n8n-nodes-whatsapp-multi-session
4. Click Install
Manual Installation
1. Navigate to your n8n installation folder
2. Open a terminal/command prompt
3. Run:
npm install n8n-nodes-whatsapp-multi-session
Docker Installation
If you’re using n8n with Docker, add this to your Dockerfile or docker-compose:
Add to your n8n Dockerfile
RUN npm install -g n8n-nodes-whatsapp-multi-session
Or for docker-compose:
services:
n8n:
image: n8nio/n8n:latest
environment:
- NPMCONFIGPREFIX=/usr/local/lib/node_modules
volumes:
- ./n8n-data:/home/node/.n8n
command: >
/bin/sh -c "
npm install -g n8n-nodes-whatsapp-multi-session &&
n8n start
"
Prerequisites
Before using this node, you need:
1. WhatsApp Multi-Session API Server running and accessible
2. API Key for authentication
3. At least one WhatsApp session configured
Setting up WhatsApp Multi-Session API
1. Deploy the WhatsApp Multi-Session API server:
git clone https://github.com/your-username/whatsapp-multi-session
cd whatsapp-multi-session
docker-compose up -d
2. Access the web interface at http://your-server:8080
3. Login with default credentials: admin / admin123
4. Create and connect a WhatsApp session
Configuration
Credentials Setup
1. In n8n, create a new credential of type “WhatsApp Multi-Session API”
2. Fill in the required fields:
– Server URL: Your API server URL (e.g., http://localhost:8080)
– API Key: Your API key for authentication
3. Test the connection and save
Node Configuration
1. Add the “WhatsApp Multi-Session” node to your workflow
2. Select your configured credentials
3. Choose the resource (Session, Message, or Contact)
4. Select the operation you want to perform
5. Fill in the required parameters
Usage Examples
1. Send a Text Message
{
"resource": "message",
"operation": "sendText",
"sessionId": "session_123",
"phoneNumber": "6281234567890",
"messageText": "Hello from n8n! 👋"
}
2. Send an Image with Caption
{
"resource": "message",
"operation": "sendImage",
"sessionId": "session_123",
"phoneNumber": "6281234567890",
"imageUrl": "https://example.com/image.jpg",
"caption": "Check out this image!"
}
3. Create a New Session
{
"resource": "session",
"operation": "create",
"sessionName": "My Bot Session"
}
4. Check if Number is on WhatsApp
{
"resource": "contact",
"operation": "check",
"sessionId": "session_123",
"phoneNumber": "6281234567890"
}
5. Send Location
{
"resource": "message",
"operation": "sendLocation",
"sessionId": "session_123",
"phoneNumber": "6281234567890",
"latitude": -6.2088,
"longitude": 106.8456,
"locationName": "Jakarta, Indonesia"
}
6. Receive WhatsApp Messages (Webhook Trigger)
The webhook trigger allows you to customize the webhook URL path for better organization:
{
"nodes": [
{
"name": "WhatsApp Message Received",
"type": "n8n-nodes-whatsapp-multi-session.whatsAppMultiSessionTrigger",
"parameters": {
"webhookPath": "my-whatsapp-bot",
"sessionIdFilter": "my_session",
"messageTypeFilter": "text",
"includeSystemMessages": false
}
},
{
"name": "Process Message",
"type": "n8n-nodes-base.function",
"parameters": {
"functionCode": "// Access the structured webhook datanconst message = $json.message;nconst senderPhone = $json.fromphone;nconst senderName = $json.fromname;nnreturn { message, senderPhone, senderName };"
}
},
{
"name": "Send Auto Reply",
"type": "n8n-nodes-whatsapp-multi-session.whatsAppMultiSession",
"parameters": {
"resource": "message",
"operation": "sendText",
"sessionId": "my_session",
"phoneNumber": "={{$json.from_phone}}",
"messageText": "Thanks for your message: {{$json.message}}"
}
}
]
}
7. Forward Message
{
"resource": "message",
"operation": "forwardMessage",
"sessionId": "session_123",
"phoneNumber": "6281234567890",
"forwardMessageId": "={{$json.id}}"
}
⚠️ Important for Forward Messages:
{{$json.id}} from the webhook trigger data8. Reply to Message
{
"resource": "message",
"operation": "replyMessage",
"sessionId": "session_123",
"phoneNumber": "={{$json.from_phone}}",
"replyText": "Thanks for your message!",
"quotedMessageId": "={{$json.id}}"
}
Webhook URL Format:
webhookPath to "my-whatsapp-bot"https://your-n8n-domain.com/webhook/my-whatsapp-botBenefits of Custom Webhook Paths:
Common Workflow Patterns
1. Auto-Reply Bot with Forward and Reply
{
"nodes": [
{
"name": "WhatsApp Message Received",
"type": "n8n-nodes-whatsapp-multi-session.whatsAppMultiSessionTrigger",
"parameters": {
"webhookPath": "auto-reply-bot",
"messageTypeFilter": "text"
}
},
{
"name": "Check Message Content",
"type": "n8n-nodes-base.switch",
"parameters": {
"rules": [
{
"operation": "contains",
"value1": "={{$json.message}}",
"value2": "forward"
},
{
"operation": "contains",
"value1": "={{$json.message}}",
"value2": "help"
}
]
}
},
{
"name": "Forward to Admin",
"type": "n8n-nodes-whatsapp-multi-session.whatsAppMultiSession",
"parameters": {
"resource": "message",
"operation": "forwardMessage",
"sessionId": "={{$json.session_id}}",
"targetPhoneNumber": "6281234567890",
"forwardMessageId": "={{$json.id}}"
}
},
{
"name": "Send Help Reply",
"type": "n8n-nodes-whatsapp-multi-session.whatsAppMultiSession",
"parameters": {
"resource": "message",
"operation": "replyMessage",
"sessionId": "={{$json.session_id}}",
"replyText": "Here's how I can help you: ...",
"replyTargetPhone": "={{$json.from_phone}}",
"quotedMessageId": "={{$json.id}}"
}
}
]
}
2. Customer Support Bot
1. WhatsApp Multi-Session Trigger → Receive incoming messages
2. WhatsApp Multi-Session → Check contact info
3. AI Node → Process message with ChatGPT/Claude
4. WhatsApp Multi-Session → Send automated response
2. Marketing Campaign
1. Spreadsheet Trigger → Read customer list
2. WhatsApp Multi-Session → Check if numbers are valid
3. Filter → Only valid WhatsApp numbers
4. WhatsApp Multi-Session → Send personalized messages
5. Database → Log sent messages
3. Order Notifications
1. E-commerce Webhook → New order received
2. WhatsApp Multi-Session → Send order confirmation
3. Wait → Delay for shipping
4. WhatsApp Multi-Session → Send tracking information
Available Operations
Session Operations
Message Operations
Contact Operations
Typing Operations
Webhook Operations
Webhook Trigger Node
Error Handling
The node includes built-in error handling:
Enable “Continue on Fail” in node settings to handle errors gracefully in your workflow.
Troubleshooting
Common Issues
1. “Authentication failed”
– Verify server URL is correct and accessible
– Check username/password credentials
– Ensure API server is running
2. “Session not found”
– Verify session ID exists
– Check if session is connected
– List sessions to see available IDs
3. “Failed to send message”
– Ensure phone number includes country code
– Verify session is connected to WhatsApp
– Check if recipient number has WhatsApp
4. “Connection timeout”
– Check network connectivity to API server
– Verify firewall/security group settings
– Increase timeout in node settings
Debug Mode
Enable debug mode in n8n to see detailed API requests and responses:
1. Set environment variable: N8NLOGLEVEL=debug
2. Restart n8n
3. Check logs for detailed error information
Forward/Reply Message Issues
Problem: Forward message appears empty or reply doesn’t show quoted message
Causes & Solutions:
1. Wrong Session: Message ID from different session
– ✅ Ensure sessionId matches the session where original message was received
2. Old Message ID: Message might have been deleted or expired
– ✅ Use recent messages (within last few hours)
– ✅ Test with a fresh message from the webhook trigger
3. Message ID Format: Using wrong message ID format
– ✅ Use {{$json.id}} directly from webhook data
– ✅ Don’t modify or parse the message ID
4. API Server Issue: Message not found in API database
– ✅ Check API server logs for “message not found” errors
– ✅ Verify message exists in WhatsApp session storage
Test Forward/Reply:
1. Send a test message to your WhatsApp
2. Check the webhook data for the message ID
3. Immediately try to forward that message
4. If it works, the issue is message ID timing/storage
API Server Requirements
Security Considerations
Support
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
License
This project is licensed under the MIT License – see the LICENSE file for details.