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. - Copy
.env.example
to.env
for set environment variables.
Edit environment variables on .env
# ==================================
# APPLICATION CONFIGURATION
# ==================================
PORT=3000
# ==================================
# DATABASE CONFIGURATION
# ==================================
MONGODB_ENABLED=false
MONGODB_URL=mongodb://127.0.0.1:27017/whatsapp_api
# ==================================
# WEBHOOK CONFIGURATION
# ==================================
WEBHOOK_ENABLED=false
WEBHOOK_URL=https://webhook.site/d0122a66-18a3-432d-b63f-4772b190dd72
WEBHOOK_BASE64=false
DEVELOPMENT:
Executenpm run dev
oryarn dev
PRODUCTION:
Executenpm run start
oryarn start
To generate an Instance Key
Using the route:
curl --location --request GET 'localhost:3333/instance/init' \
--data-raw ''
To generate a Custom Instance
Using the route:
curl --location --request GET 'http://localhost:3000/instance/init?key=CUSTOM_INSTANCE_KEY_HERE&webhook=true&webhookUrl=https://webhook.site/d7114704-97f6-4562-9a47-dcf66b07266d' \
--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.