NodeJS: 16++
- For
Linux Server
install no-gui systems ( ignore if Windows )
sudo apt install -y gconf-service libgbm-dev libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- Clone the project
git clone https://git.bintangtechnology.com/microservices/whatsapp-gateway.git
- Run npm install & update
npm install
npm update
PORT=3000
SERVER_OS=LINUX # WINDOWS OR LINUX default is LINUX
HEADLESS=true # default true
ACCESS_TOKEN=
npm run token-generate
- With npm
npm run start
- with node
node index.js
To run with pm2, first install pm2 globally
npm install pm2@latest -g
running scripts
npm run pm2-start
npm run pm2-stop
npm run pm2-delete
npm run pm2-restart
npm run pm2-reload
- Headers
Header | Type | Description |
---|---|---|
ACCESS_TOKEN |
string |
Required. Your ACCESS_TOKEN |
POST /api/status
- response
response | type | description |
---|---|---|
message |
string |
message |
state |
string |
READY or NOT_READY |
is_initialize |
boolean |
true when puppeter is already launched |
is_auth |
boolean |
true when whatsapp is linked |
is_loading |
boolean |
true when puppeter is opening web whatsapp |
is_ready |
boolean |
true when app is ready to send message |
qr_code |
string |
null when client is already login |
client_info |
Object |
null when client is not ready |
POST /api/initialize
- response
response | type | description |
---|---|---|
message |
string |
message |
POST /api/logout
- response
response | type | description |
---|---|---|
message |
string |
message |
POST /api/restart
- response
response | type | description |
---|---|---|
message |
string |
message |
POST /api/send-message
- body
body | type | example |
---|---|---|
to |
number |
621234567890 must include country code |
message |
string |
any |
- response
response | type | description |
---|---|---|
message |
string |
message |
SSE (GET) /sse/realtime
POST /sse/subscribe
- body
body | type | example |
---|---|---|
client_id |
string |
client_id from /sse/realtime |