This is a Go-based WhatsApp bot built using whatsmeow. It allows sending messages via WhatsApp Web and supports SQLite-based session storage.
- ✅ QR Code Authentication for WhatsApp Web.
- ✅ Send Messages to WhatsApp users.
- ✅ SQLite Storage for session persistence.
- ✅ Docker Support for containerized deployment.
git clone https://github.com/ozgen/whatsappbot.git
cd whatsappbotgo mod tidygo run cmd/main.go- This will generate a QR Code (
whatsapp_qr.png). - Open WhatsApp Web > Linked Devices, scan the QR code.
- Copy code in the log and generate qr code image with this website https://www.qr-code-generator.com
docker build -t whatsappbot:v1 .
docker run -d --name whatsappbot -p 9090:9090 -v "$(pwd)/data:/app/data" whatsappbotdocker-compose up -dEnsure your docker-compose.yml includes the volume:
version: '3.1'
services:
whatsappbot:
image: whatsappbot:v1
platform: linux/amd64
ports:
- "9090:9090"
volumes:
- ./data:/app/dataOnce the bot is running, you can send messages via API:
curl -X POST "http://localhost:9090/send-message" \
-H "Content-Type: application/json" \
-d '{"phone": "491234567890", "message": "123456"}'{
"message": "Message sent successfully"
}- Ensure WhatsApp Web is open and working.
- Delete
whatsapp_qr.pngand restart the bot.
If you get glibc issues, change Dockerfile base image:
FROM golang:1.23.5 AS builderRebuild:
docker build --no-cache -t whatsappbot:v1 .- The bot requires CGO for SQLite.
- Rebuild without
CGO_ENABLED=0:
CGO_ENABLED=1 go build -o whatsappbot ./cmd/main.go