A seamless, easy-to-setup bridge that connects WhatsApp and Nextcloud Talk, allowing messages to flow bidirectionally between the two platforms.
⚡ No separate phone number needed! This bridge uses WhatsApp Web's linked device feature - just scan a QR code with your existing WhatsApp account.
- 🔄 Bidirectional messaging: Messages flow seamlessly in both directions
- 🚀 Easy setup: Minimal configuration required
- 📱 WhatsApp Web integration: Uses WhatsApp Web, no unofficial APIs
- 🔐 Secure: Self-hosted on your own server
- 🐳 Docker support: Easy deployment with Docker
- 📝 Message prefixes: Clear indication of message source
- 💾 Session persistence: Stays authenticated between restarts
- Node.js 18 or higher
- A Nextcloud instance with Talk app installed
- Your existing WhatsApp account (no separate phone number required!)
📖 For a comprehensive step-by-step guide, see the Complete Tutorial
⚡ Quick setup for experienced users:
git clone https://github.com/QuizzityMC/Whatsapp-Nextcloud-Bridge.git
cd Whatsapp-Nextcloud-Bridgenpm installRun the verification script to check your setup:
./verify.shCopy the example environment file and edit it with your details:
cp .env.example .env
nano .env # or use your favorite editorFill in the following required values:
- NEXTCLOUD_URL: Your Nextcloud instance URL (e.g.,
https://cloud.example.com) - NEXTCLOUD_USERNAME: Your Nextcloud username
- NEXTCLOUD_PASSWORD: Your Nextcloud password or app password
- NEXTCLOUD_TALK_TOKEN: The conversation token from Nextcloud Talk
- WHATSAPP_CHAT_ID: The WhatsApp chat ID (format:
1234567890@c.us)
- Open Nextcloud Talk in your browser
- Navigate to the conversation you want to bridge
- The token is in the URL:
https://your-nextcloud.com/call/TOKEN_HERE
The chat ID will be displayed in the logs when you first receive a message. Alternatively:
- For individual chats:
[country_code][phone_number]@c.us(e.g.,1234567890@c.us) - For group chats: Run the bridge once and check the logs when messages are received
npm startOn first run, you'll see a QR code in the terminal. You'll use your existing WhatsApp account - no separate phone number needed!
- Open WhatsApp on your phone
- Go to Settings → Linked Devices
- Android: Tap the three-dot menu (⋮) → Linked Devices
- iOS: Tap Settings (gear icon) → Linked Devices
- Tap "Link a Device"
- Scan the QR code displayed in the terminal
How it works: The bridge acts as a linked device (like WhatsApp Web) to your existing WhatsApp account. You don't need a second phone number - it's all connected to your current WhatsApp!
Once authenticated, the bridge will start forwarding messages automatically!
Create a docker-compose.yml file:
version: '3.8'
services:
whatsapp-nextcloud-bridge:
image: node:18-alpine
working_dir: /app
volumes:
- .:/app
- session-data:/app/session
environment:
- NEXTCLOUD_URL=${NEXTCLOUD_URL}
- NEXTCLOUD_USERNAME=${NEXTCLOUD_USERNAME}
- NEXTCLOUD_PASSWORD=${NEXTCLOUD_PASSWORD}
- NEXTCLOUD_TALK_TOKEN=${NEXTCLOUD_TALK_TOKEN}
- WHATSAPP_CHAT_ID=${WHATSAPP_CHAT_ID}
- NC_TO_WA_PREFIX=${NC_TO_WA_PREFIX:-[Nextcloud]}
- WA_TO_NC_PREFIX=${WA_TO_NC_PREFIX:-[WhatsApp]}
command: sh -c "npm install && npm start"
restart: unless-stopped
volumes:
session-data:Then run:
docker-compose up -dView logs:
docker-compose logs -fBuild the image:
docker build -t whatsapp-nextcloud-bridge .Run the container:
docker run -d \
--name whatsapp-bridge \
--env-file .env \
-v $(pwd)/session:/app/session \
whatsapp-nextcloud-bridgeFor running as a system service on Linux, see the Systemd Installation Guide.
All configuration is done via environment variables:
| Variable | Required | Description | Default |
|---|---|---|---|
NEXTCLOUD_URL |
Yes | Your Nextcloud instance URL | - |
NEXTCLOUD_USERNAME |
Yes | Nextcloud username | - |
NEXTCLOUD_PASSWORD |
Yes | Nextcloud password or app password | - |
NEXTCLOUD_TALK_TOKEN |
Yes | Talk conversation token | - |
WHATSAPP_CHAT_ID |
Yes | WhatsApp chat ID to bridge | - |
NC_TO_WA_PREFIX |
No | Prefix for Nextcloud messages | [Nextcloud] |
WA_TO_NC_PREFIX |
No | Prefix for WhatsApp messages | [WhatsApp] |
SESSION_DIR |
No | Directory for session storage | ./session |
LOG_LEVEL |
No | Logging level (DEBUG, INFO, WARN, ERROR) | INFO |
The bridge uses WhatsApp Web technology, which means:
- ❌ You do NOT need a second phone number or SIM card
- ✅ You use your existing WhatsApp account
- ✅ The bridge appears as a "Linked Device" in WhatsApp (like WhatsApp Web or Desktop)
- ✅ Your phone stays the primary device
- ✅ All messages sync across devices
When you scan the QR code, the bridge links to your WhatsApp account just like WhatsApp Web does. You can manage linked devices in WhatsApp Settings → Linked Devices.
-
WhatsApp → Nextcloud: When a message is received in the configured WhatsApp chat, it's forwarded to Nextcloud Talk with a
[WhatsApp]prefix and the sender's name. -
Nextcloud → WhatsApp: When a message is posted in the configured Nextcloud Talk conversation, it's forwarded to WhatsApp with a
[Nextcloud]prefix and the sender's name. -
Authentication: WhatsApp uses session persistence, so you only need to scan the QR code once. The session data is stored in the
sessiondirectory.
For detailed troubleshooting information, see the Troubleshooting Guide.
QR Code Not Appearing
- Use
docker logs -f container-namefor Docker - Use
sudo journalctl -u whatsapp-nextcloud-bridge -ffor systemd
Authentication Failures
rm -rf session/
npm start # Scan QR code againMessages Not Being Forwarded
- Check logs for errors
- Verify configuration in
.env - See Troubleshooting Guide for detailed steps
- Complete Step-by-Step Tutorial - Comprehensive guide for first-time setup ⭐ Start here!
- Message Flow Examples - See how messages are formatted and forwarded
- Troubleshooting Guide - Detailed solutions for common issues
- Systemd Installation - Run as a Linux system service
- Contributing - Guidelines for contributing to the project
- Passwords: Use Nextcloud app passwords instead of your main password
- Session Data: The
sessiondirectory contains authentication data - keep it secure - Network: Run on a trusted network or use proper firewall rules
- HTTPS: Always use HTTPS for your Nextcloud instance
npm run devThis uses Node's watch mode to automatically restart on file changes.
.
├── src/
│ ├── index.js # Main entry point
│ ├── whatsapp-client.js # WhatsApp integration
│ ├── nextcloud-client.js # Nextcloud Talk integration
│ ├── message-bridge.js # Message bridging logic
│ └── utils/
│ └── logger.js # Logging utility
├── .env.example # Example configuration
├── package.json # Dependencies
└── README.md # This file
No! This is one of the most common questions. The bridge uses WhatsApp Web technology - you just scan a QR code with your existing WhatsApp account. No second phone number, no separate SIM card needed!
The bridge links to your existing WhatsApp account as a device (like WhatsApp Web). Messages sent from Nextcloud to WhatsApp will appear to come from "You" (your account), but they include the original sender's name in the message text (e.g., [Nextcloud] *Alice*: Hi!).
Yes! The setup is exactly the same. Just scan the QR code with your WhatsApp Business account.
No. WhatsApp supports multiple linked devices simultaneously. The bridge is just another linked device.
WhatsApp's multi-device feature allows the bridge to work even when your phone is offline. However, your phone needs to be online at least once every 14 days to keep devices linked.
Yes! Run multiple instances of the bridge with different configurations. See the Tutorial for details.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - feel free to use this for any purpose.
If you encounter any issues or have questions, please open an issue on GitHub.
- Built with whatsapp-web.js
- Uses the Nextcloud Talk API
Note: This bridge is not affiliated with WhatsApp or Nextcloud. Use at your own risk.