Skip to content

Simple REST API wrapper for whatsapp-web.js

License

Notifications You must be signed in to change notification settings

rsuppersahabatan/wapi

This branch is 1 commit behind yohanesgultom/wapi:main.

Folders and files

NameName
Last commit message
Last commit date
Nov 16, 2023
Sep 4, 2023
Nov 12, 2022
Sep 10, 2023
Jan 14, 2025
May 7, 2022
Feb 18, 2024
Nov 10, 2023
May 12, 2023
May 7, 2022
Nov 26, 2022
Sep 10, 2023
May 12, 2023
Mar 19, 2025
Mar 19, 2025
Sep 10, 2023

Repository files navigation

๐Ÿฅ— WAPI

Test

Simple REST API wrapper for the super awesome whatsapp-web.js

โš ๏ธ Due to the nature of the whatsapp-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

โš™๏ธ Setup

With Docker:

  1. Clone repo
  2. Copy config.example.json to config.json and set desired user & password (for Basic Authentication) and port (for API server)
  3. Build: docker build -t wapi:latest .
  4. Run: docker run --name wapi -e DOCKERIZED=1 -p 4000:4000 -d wapi:latest

Without Docker:

  1. Clone repo
  2. Copy config.example.json to config.json and set desired user & password (for Basic Authentication) and port (for API server)
  3. Run npm install
  4. Run npm start

๐Ÿ› ๏ธ Development

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

๐Ÿฑ API

All APIs require Basic Authentication using the user & password in config.json:

  1. GET /

    Health check

  2. GET /qr

    Get authentication QR code image

  3. GET /contacts/:contactId

    Get contact details by id .eg [email protected]

  4. 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, the content must be base64-encoded. Example:

     {
       "number":"6288290764816",
       "message":"Hello world ๐Ÿ™",
       "attachments": [{"filename": "hello.txt", "mime":"text/plain", "content":"aGVsbG8K"}]
     }
    
  5. GET /groups

    Get list of groups (id and name) where this account is included

  6. GET /webhooks

    Get all webhooks

  7. POST /webhooks

    Add a webhook: Example:

     {
         "postUrl": "http://localhost:4000/test",
         "authHeader": "Basic c2VjcmV0Cg==",
         "eventCode": "INCOMING_MESSAGE"
     }
    
  8. DELETE /webhooks/:id

    Delete a webhook

About

Simple REST API wrapper for whatsapp-web.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.6%
  • Dockerfile 2.6%
  • Shell 0.8%