The automated husband assistant (sending regular appreciation texts over WhatsApp with AI-generated messages).
- Create an DigitalOcena VM instance (Droplet, 512 MB) on the cheapest tier using Ubuntu.
- Connect to the VM using SSH.
- Install prerequisites:
sudo apt update && sudo apt upgrade -y
sudo apt install -y chromium-browser
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejsmkdir husbot && cd husbot
npm init -y
npm install whatsapp-web.js qrcode-terminal node-schedule @google/generative-aiCopy this repository's index.js into your project and update the placeholders:
MY_NUMBERWIFE_NUMBERGEMINI_API_KEY
Optional .env settings:
HEARTBEAT_DAYS— how often (in days) to send a heartbeat ping to your phone (default:3)
- Uses
LocalAuthso WhatsApp login persists after first QR scan. - Uses Linux Chromium at
/usr/bin/chromium-browserfor cloud/headless runtime. - Supports control commands by messaging yourself:
/status/pause/resume/send_now
- Schedules 1–3 AI-generated appreciation messages each week at randomized day/time windows.
- Each AI-generated message is randomly written in English or German (command responses and heartbeats are always in English).
- Re-plans automatically every Sunday at 11:59 PM.
- Sends a heartbeat message to your phone every few days so you know the bot is still alive (configurable via
HEARTBEAT_DAYS, default: 3).
sudo npm install -g pm2
pm2 start index.js --name wife-bot
pm2 logs wife-botScan the QR code from logs via WhatsApp Linked Devices. After that, the bot runs in the background continuously.
If you run into memory problems (e.g. you use a DigitalOcean VPS with not enough RAM), think about creating swap space.
# Create a 1GB swap file
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make it permanent so it stays after a reboot
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab