This project is a WhatsApp automation bot that allows you to send messages via WhatsApp Web using whatsapp-web.js and Puppeteer. It also supports:
- Fetching data from an external API before sending messages.
- Executing a cURL command after sending a message.
✅ Send messages to WhatsApp numbers. ✅ Validate if a number is registered on WhatsApp. ✅ Fetch additional data from an external API and append it to the message. ✅ Execute a cURL command after sending a message. ✅ Logs errors and execution status.
git clone https://github.com/mhamidjamil/whatsapp-automation
cd whatsapp-automationsudo apt-get update
sudo apt-get install -y \
ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 \
libatk1.0-0 libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libnspr4 libnss3 \
libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 xdg-utils wget
npm installnpm startThis will start the server on http://localhost:3008.
- When you run the server for the first time, a QR code will appear in the console.
- Scan it using WhatsApp Web on your phone.
- Once scanned, the bot will be ready to send messages.
Method: POST
{
"number": "+923354888420",
"message": "Hello from WhatsApp Bot!",
"externalApiUrl": "https://jsonplaceholder.typicode.com/todos/1",
"curlCommand": "curl -X GET http://example.com/api"
}{
"status": "Message sent successfully!"
}- Formats the phone number to WhatsApp format.
- Checks if the number is registered on WhatsApp.
- Fetches additional data from the given
externalApiUrland appends it to the message. - Sends the message via WhatsApp Web.
- Executes the provided cURL command if available.
| Error | Solution |
|---|---|
wid error: invalid wid |
Ensure the phone number is registered on WhatsApp. |
Error sending message |
Restart the server and rescan the QR code. |
Error executing cURL |
Check if the cURL command syntax is correct. |
This project is licensed under the MIT License.
Developed by Your Name. 🚀 Feel free to contribute and enhance the bot!
- Fork the repository.
- Create a feature branch.
- Open a pull request!
Enjoy automating WhatsApp messages! 📩🔥