This is a WhatsApp bot built with Express.js that connects through the WhatsApp Web browser app and uses the WhatsApp Web client library for the WhatsApp Web API.
- Send text messages to multiple individuals or groups simultaneously via API.
- Send file messages with or without captions to multiple individuals or groups simultaneously via API.
- Send images as base64
- Check WhatsApp Group IDs.
- Test response with
!ping
. - Check logs with
!logs
. - Delete messages by message id
!deleteMessage,yourmessageid
(You can check messageId in the logs😊) - ✨ Ask AI with
!AI your question
.✨
- Clone the repository using
git clone https://github.com/nestorzamili/whatsapp-web.js.git
. - Run
npm install
to install the dependencies. - Run
npm start
to start the bot.
The bot will display a QR code in the terminal. Scan this QR code with your phone to log in to WhatsApp Web and start using the bot.
You can generate your own API Key using Node.js in your terminal by executing the following command:
echo "samunu_$(openssl rand -hex 32)"
GET http://localhost:3000/get-group-id
Parameter | Type | Description |
---|---|---|
x-api-key |
string |
Required. Your API key |
groupName |
string |
Requierd. Type only 1 group name |
POST http://localhost:3000/send-plaintext
Parameter | Type | Description |
---|---|---|
x-api-key |
string |
Required. Your API key |
ids |
string |
Required. Single or Multiples ID, separate with comma without space. Example: 120363185xxxxxx@g.us,120363199xxxxxx@g.us |
Content-Type |
text/plain |
|
body |
string |
Example:This is a test |
POST http://localhost:3000/send-file
Parameter | Type | Description |
---|---|---|
x-api-key |
string |
Required. Your API key |
ids |
string |
Required. Single or Multiples ID, separate with comma without space. Example: 120363185xxxxxx@g.us,120363199xxxxxx@g.us |
Content-Type |
form-data |
or application/json |
attachment |
file |
Required. Example:D:/test.jpg |
caption |
string |
Optional |
POST http://localhost:3000/send-base64-image
Parameter | Type | Description |
---|---|---|
x-api-key |
string |
Required. Your API key |
ids |
string |
Required. Single or Multiples ID, separate with comma without space. Example: 120363185xxxxxx@g.us,120363199xxxxxx@g.us |
Content-Type |
application/json |
|
body |
json |
see example JSON body |
Example JSON body:
{
"caption": "caption",
"images": [
{
"mimetype": "image/jpeg",
"data": "base64encodedstring...",
"filename": "image1.jpg"
},
{
"mimetype": "image/png",
"data": "base64encodedstring...",
"filename": "image2.png"
}
]
}
Use the app.js
file if you want to use localAuth, use the remoteAuth.js
file if you want to use AWS S3 for auth. Edit your package.json
file
See more details here https://docs.wwebjs.dev/
Contributions are always welcome! Please Fork this repository.
This project is licensed under the Apache-2.0 License. See the LICENSE
file for more details.