Prerequisites
- Node.js ≥18 installed on your system
- A phone with WhatsApp installed
- Access to WhatsApp’s “Linked Devices” feature
Features
- ✅ No API key required
- ✅ Direct device linking via QR code
- ✅ Phone number-based access control
- ✅ Simple setup and configuration
Setup
Check Node.js version
Scan QR code
On your phone:
- Open WhatsApp
- Go to Settings → Linked Devices
- Tap Link a Device
- Scan the QR code displayed in your terminal
Configure nanobot
Edit
~/.nanobot/config.json:Use full international format:
+[country code][phone number]Run two terminals
You need to keep both processes running:Terminal 1 (WhatsApp session):Terminal 2 (Gateway):
Configuration Options
Enable the WhatsApp channel
List of phone numbers allowed to interact with the botFormat: Use international format with
+ prefixExamples:- Single number:
["+1234567890"] - Multiple:
["+1234567890", "+9876543210"]
Running in Production
Using process managers (pm2, systemd)
Using process managers (pm2, systemd)
Troubleshooting
QR code not appearing
QR code not appearing
- Verify Node.js version:
node --version(must be ≥18) - Check terminal size (QR code needs space to render)
- Try running in a different terminal emulator
- Clear WhatsApp session:
rm -rf ~/.nanobot/whatsapp-sessionand retry
Bot doesn't respond to messages
Bot doesn't respond to messages
- Verify phone number format in
allowFrom(must include+and country code) - Check both terminals are running:
nanobot channels loginnanobot gateway
- Verify device is still linked in WhatsApp → Settings → Linked Devices
- Check logs with:
nanobot gateway -v
Connection lost / Session expired
Connection lost / Session expired
If the linked device session expires:
- Stop both processes
- Remove session data:
rm -rf ~/.nanobot/whatsapp-session - Re-run
nanobot channels loginand scan QR code again - Restart gateway
Node.js version error
Node.js version error
Error: “Node.js 18 or higher is required”Solution: Upgrade Node.js
Two terminals are inconvenient
Two terminals are inconvenient
Use a process manager like pm2 or systemd to run both processes as background services.See “Running in Production” section above.
Complete Example
Full configuration:Related Pages
Configuration Overview
Learn about channel configuration
Security Settings
Set up access control