An implementation of Baileys as a simple RESTful API service with multi device support just download
, install
, and start
using, simple
as that.
- Download or clone this repo.
- Enter to the project directory.
- Execute
yarn install
ornpm install
to install the dependencies.
Edit this constant in src/config/config.js
// Port number
const PORT = '3333'
// URL of Mongo DB
const MONGODB_URL = 'mongodb://127.0.0.1:27017/WhatsAppInstance'
// Webhook URL
const WEBHOOK_URL = 'https://webhook.site/d0122a66-18a3-432d-b63f-4772b190dd72'
- You can start the server by executing
npm run start
oryarn start
To generate an Instance Key
Using the route:
curl --location --request GET 'localhost:3333/instance/init' \
--data-raw ''
Response:
{
"error": false,
"message": "Initializing successfull",
"key": "d7e2abff-3ac8-44a9-a738-1b28e0fca8a5"
}
Save the value of the key
from response. Then use this value to call all the routes.
#Get qrcode
# /instance/qr?key=KEY
curl --location --request GET 'localhost:3333/instance/qr?key=123'
#Send Message
# /message/text?key=KEY&id=ID&message=MESSAGE
curl --location --request POST 'localhost:3333/message/text?key=123' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'id=919999999999' \
--data-urlencode 'message=Hello World'
See all routes here src/api/routes
- This code is in no way affiliated, authorized, maintained, sponsored or endorsed by WA(WhatsApp) or any of its affiliates or subsidiaries.
- The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
- This is an independent and unofficial software Use at your own risk.
- Do not spam people with this.