Simple REST API wrapper for the super awesome whatsapp-web.js
⚠️ Due to the nature of thewhatsapp-web.js
dependency on WhatsApp Web behaviours, regular maintainance is required (library update, temporary workaround). If you face any unknown issue that is not fixed in this wrapper, consider checking whatsapp-web.js issue page
With Docker:
- Clone repo
- Copy
config.example.json
toconfig.json
and set desireduser
&password
(for Basic Authentication) andport
(for API server) - Build:
docker build -t wapi:latest .
- Run:
docker run --name wapi -e DOCKERIZED=1 -p 4000:4000 -d wapi:latest
Without Docker:
- Clone repo
- Copy
config.example.json
toconfig.json
and set desireduser
&password
(for Basic Authentication) andport
(for API server) - Run
npm install
- Run
npm start
With Docker:
docker run --name wapi-dev -e DOCKERIZED=1 -p 4000:4000 -d -v $PWD:/home/api wapi:latest
docker exec -u 0 -it wapi-dev bash
All APIs require Basic Authentication using the user
& password
in config.json
:
-
GET
/
Health check
-
GET
/qr
Get authentication QR code image
-
GET
/contacts/:contactId
Get contact details by id .eg
6281311525264@c.us
-
POST
/send
Send a message to an individual or group chat (
number
can contain phone number with country code or a group id).attachments
is optional. But when provided, thecontent
must be base64-encoded. Example:{ "number":"6288290764816", "message":"Hello world 🙏", "attachments": [{"filename": "hello.txt", "mime":"text/plain", "content":"aGVsbG8K"}] }
-
GET
/groups
Get list of groups (id and name) where this account is included
-
GET
/webhooks
Get all webhooks
-
POST
/webhooks
Add a webhook: Example:
{ "postUrl": "http://localhost:4000/test", "authHeader": "Basic c2VjcmV0Cg==", "eventCode": "INCOMING_MESSAGE" }
-
DELETE
/webhooks/:id
Delete a webhook