Simple REST API wrapper for the super awesome whatsapp-web.js
⚠️ Due to the nature of thewhatsapp-web.jsdependency 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.jsontoconfig.jsonand 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.jsontoconfig.jsonand 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
/qrGet authentication QR code image
-
GET
/contacts/:contactIdGet contact details by id .eg
6281311525264@c.us -
POST
/sendSend a message to an individual or group chat (
numbercan contain phone number with country code or a group id).attachmentsis optional. But when provided, thecontentmust be base64-encoded. Example:{ "number":"6288290764816", "message":"Hello world 🙏", "attachments": [{"filename": "hello.txt", "mime":"text/plain", "content":"aGVsbG8K"}] } -
GET
/groupsGet list of groups (id and name) where this account is included
-
GET
/webhooksGet all webhooks
-
POST
/webhooksAdd a webhook: Example:
{ "postUrl": "http://localhost:4000/test", "authHeader": "Basic c2VjcmV0Cg==", "eventCode": "INCOMING_MESSAGE" } -
DELETE
/webhooks/:idDelete a webhook