This tutorial will guide you through setting up the WhatsApp-Nextcloud Bridge step-by-step. Important: You do NOT need a separate phone number - the bridge uses your existing WhatsApp account via WhatsApp Web's linked device feature.
- Prerequisites
- Understanding How It Works
- Installation Steps
- Configuration Guide
- First Time Setup
- Verifying the Setup
- Advanced Topics
Before you begin, make sure you have:
- โ A Nextcloud instance with the Talk app installed and configured
- โ Node.js 18 or higher installed on your server
- โ Your existing WhatsApp account on your phone (no separate number needed!)
- โ Basic terminal/command line knowledge
- โ SSH access to your server (if deploying remotely)
node -v
# Should show v18.0.0 or higherIf Node.js is not installed or version is lower than 18:
- Ubuntu/Debian:
sudo apt install nodejs npm - macOS:
brew install node - Other systems: Visit https://nodejs.org/
- Log into your Nextcloud instance
- Click the "Talk" icon in the top menu
- If you don't see it, install the Talk app from the Apps section
Important Clarification: This bridge uses WhatsApp Web, which means:
- โ You do NOT need a second phone number
- โ You do NOT need a separate SIM card
- โ You do NOT need a virtual phone number service
- โ You DO use your existing WhatsApp account
- โ The bridge appears as a "Linked Device" in WhatsApp (like WhatsApp Web or Desktop)
How WhatsApp Linking Works:
- WhatsApp allows you to link multiple devices to one account
- When you scan the QR code, you're linking the bridge as a new device
- The bridge receives and sends messages on behalf of your WhatsApp account
- Your phone stays the primary device
- All messages sync across all linked devices
What appears in WhatsApp:
- Messages sent by the bridge will appear to come from you
- The bridge uses your WhatsApp account's identity
- Messages will show in your chat history on your phone too
Nextcloud Talk Bridge Server WhatsApp
โ โ โ
โ 1. Alice: "Hello!" โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ>โ โ
โ โ 2. [Nextcloud] Alice: โ
โ โ "Hello!" โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ>โ
โ โ โ
โ โ 3. Bob: "Hi there!" โ
โ โ<โโโโโโโโโโโโโโโโโโโโโโโโโค
โ 4. [WhatsApp] Bob: โ โ
โ "Hi there!" โ โ
โ<โโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
# Navigate to where you want to install the bridge
cd /opt # or ~/apps or anywhere you prefer
# Clone the repository
git clone https://github.com/QuizzityMC/Whatsapp-Nextcloud-Bridge.git
cd Whatsapp-Nextcloud-Bridgenpm installThis will download all required packages, including the WhatsApp Web client libraries.
Note: If you encounter Chromium download errors, this is normal in some environments. The bridge will work fine.
The repository includes a verification script to check your setup:
chmod +x verify.sh
./verify.shThis checks that all dependencies are correctly installed.
cp .env.example .env
nano .env # or use vim, code, or any text editorYour Nextcloud URL is simply the address you use to access Nextcloud:
NEXTCLOUD_URL=https://cloud.example.com
Include https:// but don't include any path like /index.php
NEXTCLOUD_USERNAME=your-username
NEXTCLOUD_PASSWORD=your-password
Security Tip: Use an app password instead of your main password:
- Log into Nextcloud
- Go to Settings โ Security
- Scroll to "Devices & sessions"
- Create a new app password
- Name it "WhatsApp Bridge"
- Use this password in your configuration
The Talk token identifies which conversation to bridge.
How to find it:
- Open Nextcloud Talk in your browser
- Navigate to the conversation you want to bridge
- Look at the URL in your browser's address bar
- The token is the part after
/call/
Example URL:
https://cloud.example.com/call/x7k9m2p5
^^^^^^^^
This is your token
Copy the token to your .env file:
NEXTCLOUD_TALK_TOKEN=x7k9m2p5
The WhatsApp Chat ID identifies which WhatsApp chat to bridge.
For now, use a placeholder:
WHATSAPP_CHAT_ID=placeholder@c.us
We'll get the real chat ID in the next section when we first run the bridge.
You can customize how messages are labeled:
NC_TO_WA_PREFIX=[Nextcloud] # Messages from Nextcloud to WhatsApp
WA_TO_NC_PREFIX=[WhatsApp] # Messages from WhatsApp to Nextcloud
Creative alternatives:
NC_TO_WA_PREFIX=๐ฌ
WA_TO_NC_PREFIX=๐ฑ
Or remove prefixes entirely:
NC_TO_WA_PREFIX=
WA_TO_NC_PREFIX=
Your .env file should look like this:
# Nextcloud Configuration
NEXTCLOUD_URL=https://cloud.example.com
NEXTCLOUD_USERNAME=johndoe
NEXTCLOUD_PASSWORD=your-app-password-here
NEXTCLOUD_TALK_TOKEN=x7k9m2p5
# WhatsApp Configuration
WHATSAPP_CHAT_ID=placeholder@c.us
# Bridge Configuration (optional)
NC_TO_WA_PREFIX=[Nextcloud]
WA_TO_NC_PREFIX=[WhatsApp]
# Session directory (optional)
SESSION_DIR=./session
# Logging (optional)
LOG_LEVEL=INFOnpm startYou'll see output like:
[Main] Starting WhatsApp-Nextcloud Bridge...
[WhatsApp] Initializing WhatsApp client...
[Nextcloud] Initializing Nextcloud client...
[Nextcloud] Successfully connected to Nextcloud Talk
After a few seconds, a QR code will appear in your terminal:
[WhatsApp] Scan this QR code with WhatsApp to authenticate:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโ โโโโโ โโโ โโโโ โโโโโ โโโโ
โโโโ โ โ โโโโโ โโ โ โ โโโโ
...
On your phone:
- Open WhatsApp
- Tap the three dots (โฎ) or Settings
- Select "Linked Devices"
- Tap "Link a Device"
- Your camera will open
- Scan the QR code displayed in your terminal
What happens:
- WhatsApp will link the bridge as a new device
- The bridge appears in your Linked Devices list as "WhatsApp Web"
- You'll see a confirmation message in the terminal
[WhatsApp] WhatsApp authenticated successfully
[WhatsApp] WhatsApp client is ready!
Now we need to find the Chat ID for the conversation you want to bridge.
Enable debug logging:
- Stop the bridge (press Ctrl+C)
- Edit
.envand change:LOG_LEVEL=DEBUG - Start the bridge again:
npm start
Send a test message:
- Open WhatsApp on your phone
- Go to the chat you want to bridge (could be a group or individual chat)
- Send any message (like "test")
- Look at the bridge terminal output
You'll see something like:
[WhatsApp] Message received from: 1234567890@c.us
[WhatsApp] Message received from: 123456789123@g.us # for groups
Copy the Chat ID:
- For individual chats:
1234567890@c.us - For group chats:
123456789123@g.us
Update your configuration:
- Stop the bridge (Ctrl+C)
- Edit
.env:WHATSAPP_CHAT_ID=1234567890@c.us # Use your actual chat ID LOG_LEVEL=INFO # Optional: change back to INFO - Save the file
npm startThe bridge is now fully configured and running! You should see:
[Main] Starting WhatsApp-Nextcloud Bridge...
[WhatsApp] WhatsApp client is ready!
[Nextcloud] Successfully connected to Nextcloud Talk
[Bridge] Message bridge is now active
[Main] Bridge started successfully!
[Main] Press Ctrl+C to stop
- Open Nextcloud Talk in your browser
- Navigate to the bridged conversation
- Send a message: "Hello from Nextcloud!"
- Check WhatsApp on your phone
- You should see:
[Nextcloud] YourName: Hello from Nextcloud!
- Open WhatsApp on your phone
- Go to the bridged chat
- Send a message: "Hello from WhatsApp!"
- Check Nextcloud Talk in your browser
- You should see:
[WhatsApp] ContactName: Hello from WhatsApp!
In WhatsApp:
- Messages appear to come from your account (because the bridge uses your WhatsApp)
- Messages sent from Nextcloud will show with your name
- The prefix helps distinguish the source
In Nextcloud Talk:
- Messages show with the WhatsApp contact's name
- The prefix shows they came from WhatsApp
Messages not appearing in WhatsApp:
- Verify
WHATSAPP_CHAT_IDis correct - Check bridge logs for errors
- Ensure WhatsApp is still linked (check Linked Devices)
Messages not appearing in Nextcloud:
- Verify
NEXTCLOUD_TALK_TOKENis correct - Check that your Nextcloud user has access to the conversation
- Ensure Nextcloud is accessible from your server
No QR code appears:
- Make sure your terminal supports QR code display
- Try viewing logs if running in Docker:
docker logs -f container-name
The bridge should run continuously. See:
- Systemd Installation Guide for Linux
- Docker Deployment for containerized setup
Create a docker-compose.yml file:
version: '3.8'
services:
whatsapp-bridge:
image: node:18-alpine
working_dir: /app
volumes:
- .:/app
- whatsapp-session:/app/session
env_file: .env
command: sh -c "npm install && npm start"
restart: unless-stopped
volumes:
whatsapp-session:Run with:
docker-compose up -d
docker-compose logs -f # View the QR code and logsTo bridge multiple WhatsApp chats to different Nextcloud conversations:
- Clone or copy the bridge directory for each chat pair
- Configure each with different
.envfiles - Run each instance separately (use different
SESSION_DIRfor each)
Example:
# First bridge
cd /opt/whatsapp-bridge-1
# Configure .env for first chat pair
npm start
# Second bridge
cd /opt/whatsapp-bridge-2
# Configure .env for second chat pair
npm start- Use App Passwords: Never use your main Nextcloud password
- Secure the
.envfile:chmod 600 .env
- Protect session data:
chmod 700 session/
- Use HTTPS: Always use HTTPS for your Nextcloud instance
- Firewall: Ensure your server has proper firewall rules
- Updates: Keep the bridge and dependencies updated
By default, the bridge polls Nextcloud for new messages every 5 seconds. To reduce server load, you can increase this interval.
Edit src/nextcloud-client.js and find the startPolling call (around line 107):
// Change from default 5000ms to 10000ms (10 seconds)
startPolling(10000) // Poll every 10 seconds instead of 5Or modify where it's called in src/message-bridge.js (line 26):
// Start polling Nextcloud messages every 10 seconds
this.nextcloudClient.startPolling(10000);Edit src/message-bridge.js to customize how messages are formatted:
// Example: Add timestamps
const formattedMessage = `${this.config.waToNcPrefix} **${sender}** (${new Date().toLocaleTimeString()}): ${messageText}`;View logs in real-time:
npm start # Logs appear in the consoleWith systemd:
sudo journalctl -u whatsapp-nextcloud-bridge -fWith Docker:
docker logs -f whatsapp-bridgeDebug mode for troubleshooting:
LOG_LEVEL=DEBUG npm startNo! The bridge uses WhatsApp Web technology, which allows you to link multiple devices to one WhatsApp account. You only need your existing WhatsApp number.
No. WhatsApp allows multiple linked devices. The bridge is just another linked device alongside your WhatsApp Web sessions.
Yes! The setup is identical. Just use your WhatsApp Business account when scanning the QR code.
WhatsApp's multi-device feature allows linked devices to work even when your phone is offline. However, your phone must have an internet connection at least once every 14 days to keep devices linked.
Yes! The bridge includes the sender's name in the forwarded message:
- From WhatsApp:
[WhatsApp] **John**: Hello - From Nextcloud:
[Nextcloud] *Alice*: Hi
Currently, only text messages are supported. Media support is planned for future versions.
Yes! Run multiple instances of the bridge with different configurations. See Bridging Multiple Chats.
- Stop the bridge (Ctrl+C or stop the service)
- On your phone, go to WhatsApp โ Linked Devices
- Find the bridge device and tap "Log Out"
- Optionally, delete the session folder:
rm -rf session/
No, this is an independent open-source project. It's not affiliated with or endorsed by WhatsApp or Nextcloud.
For detailed troubleshooting, see the Troubleshooting Guide.
Quick fixes:
- QR code not showing: Check you're in a terminal that supports QR codes, or view Docker/systemd logs
- Authentication failed: Delete
session/folder and scan QR code again - Messages not forwarding: Verify chat IDs and tokens in
.env, check logs for errors - Bridge disconnects: Check internet connection, verify WhatsApp is still linked in Linked Devices
If you need help:
- Check the Troubleshooting Guide
- Review the Message Flow Examples
- Enable debug logging:
LOG_LEVEL=DEBUG - Check GitHub Issues
- Open a new issue with your logs (remove sensitive info first)
Now that your bridge is set up:
- โ Consider running it as a system service for automatic startup
- โ Set up monitoring to ensure it stays running
- โ Join the community to share tips and improvements
- โ Star the repository if you find it useful!
Congratulations! Your WhatsApp-Nextcloud Bridge is now running. Messages will flow seamlessly between WhatsApp and Nextcloud Talk without needing any separate phone number!