Step 1: Prepare the Folder
- Create a folder for WhatsApp API:
mkdir -p /opt/whatsapp cd /opt/whatsapp - Create the
docker-compose.ymlfile:
Paste the following content:nano docker-compose.ymlversion: "3.9" services: postgres: image: postgres:14 container_name: whatsapp_postgres environment: POSTGRES_USER: whatsapp POSTGRES_PASSWORD: strongpassword123 POSTGRES_DB: whatsappdb volumes: - whatsapp_postgres_data:/var/lib/postgresql/data restart: always whatsapp: image: dimaskiddo/go-whatsapp-multidevice-rest:latest container_name: whatsapp_api depends_on: - postgres environment: HTTP_LISTEN_ADDRESS: "0.0.0.0" HTTP_LISTEN_PORT: "3000" DATABASE_DRIVER: "postgres" DATABASE_CONNECTION: "postgres://whatsapp:strongpassword123@postgres:5432/whatsappdb?sslmode=disable" WHATSAPP_SESSION_DIR: "/app/sessions" WHATSAPP_SESSION_AUTO_SAVE: "true" ports: - "3000:3000" volumes: - whatsapp_sessions:/app/sessions restart: always volumes: whatsapp_postgres_data: whatsapp_sessions: - Create a
.envfile (optional but recommended):
Paste:nano .envHTTP_LISTEN_ADDRESS=0.0.0.0 HTTP_LISTEN_PORT=3000 DATABASE_DRIVER=postgres DATABASE_CONNECTION=postgres://whatsapp:strongpassword123@postgres:5432/whatsappdb?sslmode=disable WHATSAPP_SESSION_DIR=/app/sessions WHATSAPP_SESSION_AUTO_SAVE=true - Start the containers:
docker compose up -d - Check if the API is running:
docker ps docker logs -f whatsapp_api - Access WhatsApp API and QR login:
Scan the QR code with your WhatsApp account to start.http://YOUR_VPS_IP:3000/api/v1/whatsapp/docs/
💡 Note: This setup uses PostgreSQL for database storage. It prevents errors like
SQLITE_BUSY and allows multiple WhatsApp accounts to run smoothly.