v0.1
Alvian Zachry Faturrahman
🔗 whatsapp-web.js
A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app.
The project is a service that will send and receive whatsapp chat requests from a registered whatsapp account. The library uses puppeteer
to run since whatsapp doesn't let any direct API calls aside from it's registered whatsapp for business APIs.
This is a simple project to create a whatsapp web client using express and socket.io, with mongoose as an ODM (Object Document Model) to store session data since Whatsapp already stores the chats in its own internal database.
git clone git@bitbucket.org:biteship/biteship-whatsapp-node.git
npm i
Please find and change INTRO_IMG_SELECTOR
variable on node_modules/whatsapp-web.js/src/Client.js
for it to work to:
const INTRO_IMG_SELECTOR = '[data-icon=\'search\']';
The API will be available on ${BASE_URL}/v1/:endpoint
route. List of available routes are:
used to retrieve authorization status of the whatsapp client. If the client has not been logged in before it will return a code
string that needs to be converted into a QR Code in the front end.
Response object:
{
"success": Boolean,
"qr_code": String,
"auth": Boolean,
"error": Object | String
}
Response example:
{
"success": true,
"code": "2jsadh7h7h@,asdhuo3na1238489797649@1i,234811237=1"
"auth": false,
"error": null
}
used to send and retrieve chats from a whatsapp client.
Request body:
{
"number": String,
"message": String
}
Response object:
{
"success": Boolean,
"status": String,
"message": String,
"number": String,
"error": Object | String
}
Response example:
{
"success": true,
"message": "test send from API",
"number": "621378202071",
"status": "Message Sent"
}