Skip to content

About

πŸ’¬ Self-hosted WhatsApp send API (Baileys) β€” send messages via simple HTTP calls

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

Repository files navigation

Baileys WhatsApp Send API

Developed by Mohammad Rameez Imdad (Rameez Scripts) WhatsApp: https://wa.me/923224083545 (For Custom Projects) YouTube: https://www.youtube.com/@rameezimdad (Subscribe for more!)

Send WhatsApp messages from any app with a simple HTTP call. Scan a QR once β€” done. Send-only and fire-and-forget β€” incoming messages are ignored and delivery/seen receipts are not tracked. Built-in anti-ban protection (all automatic): one message at a time with a random 5–9s gap, "typing…" simulation before each send, a 30–60s cool-down every 20 messages, a daily send limit (default 500/day), and recipients are verified on WhatsApp before sending. Tune everything in .env (MESSAGE_DELAY_MIN/MAX_MS, TYPING_SIMULATION, BURST_SIZE, DAILY_SEND_LIMIT…). CORS is open to any origin by default (CORS_ORIGINS=*) β€” call it from any website, app, localhost or file:// page.

Use it from Google Apps Script / Sheets: see clients/apps-script.


⚑ Install β€” 3 steps

Needs: a VPS with Ubuntu 24.04 (or 22.04), logged in as root. Repo note: make this repo Public on GitHub before installing, set back to Private after.

1. Open the VPS terminal (Hostinger hPanel β†’ your VPS β†’ Browser terminal)

2. Paste this and press Enter:

curl -fsSLo i.sh https://raw.githubusercontent.com/rameezimdad/baileys-api/master/deploy/vps-install.sh && bash i.sh

3. Wait 3–5 min. It prints your ADMIN API KEY β€” copy and save it (shown only once). Open http://YOUR_VPS_IP/ β†’ paste the key β†’ scan the QR with WhatsApp (Settings β†’ Linked devices β†’ Link a device).

βœ… That's it. The dashboard now shows a test-send form, an API Keys panel, and ready-made code examples.

Reinstall from zero (new key + new QR): same command but bash i.sh --fresh

πŸ”„ Update an existing install (one command)

Already installed? Get the latest code without losing anything β€” same .env, same API keys, same WhatsApp session (no QR re-scan), message history intact:

curl -fsSLo u.sh https://raw.githubusercontent.com/rameezimdad/baileys-api/master/deploy/vps-update.sh && bash u.sh

Repo note: same as install β€” make the repo Public while running this, set back to Private after (or pass a GitHub token: bash u.sh YOUR_TOKEN).

Run it on every client VPS whenever you ship a new version β€” takes ~1 minute.

πŸ—‘οΈ Delete old install (manual cleanup)

Run these one by one if you want to remove everything yourself:

pm2 delete baileys-api
rm -rf /opt/baileys-api ~/baileys-api ~/i.sh
rm -f /etc/nginx/sites-enabled/baileys-api /etc/nginx/sites-available/baileys-api
systemctl reload nginx

(bash i.sh --fresh does the same cleanup automatically before installing.)


πŸ“€ Send a message

curl -X POST http://YOUR_VPS_IP/api/send-message \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"923001234567","message":"Hello"}'
  • Number = country code + number, no +
  • Also: /api/send-image, /api/send-document, /api/send-audio (multipart field file), /api/send-location
  • Bulk? Fire away β€” extra messages reply "status":"queued" instantly and send automatically, safely spaced
  • Make one key per app from the dashboard's API Keys panel

🌐 Domain + HTTPS (optional)

  1. Cloudflare β†’ add domain β†’ DNS: A @ β†’ VPS_IP and A www β†’ VPS_IP, both Proxied 🟠
  2. Set Cloudflare's nameservers at your registrar
  3. ⚠️ Cloudflare β†’ SSL/TLS β†’ Overview β†’ "Flexible" (otherwise error 522)
  4. On the VPS:
sed -i 's|^PUBLIC_DOMAIN=.*|PUBLIC_DOMAIN=yourdomain.com|' /opt/baileys-api/.env && pm2 restart baileys-api --update-env

πŸ”„ Update to latest code

bash i.sh

(Same installer β€” it keeps your .env, API keys, and WhatsApp session. Repo must be Public for the moment.)

πŸ› οΈ Daily commands

What Command
Status / logs pm2 status Β· pm2 logs baileys-api
Restart pm2 restart baileys-api
Forgot admin key grep ADMIN_API_KEY /opt/baileys-api/.env
Anti-ban gap MESSAGE_DELAY_MIN_MS / MESSAGE_DELAY_MAX_MS in /opt/baileys-api/.env (then restart) β€” default 5000–9000

Detailed manual install & troubleshooting: INSTALL.md

About

πŸ’¬ Self-hosted WhatsApp send API (Baileys) β€” send messages via simple HTTP calls

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages