Usage Scenarios for the API
Note: Install Node.js v16+ if you havenβt already.
We are going to use whatsapp-api-nodejs that converts users WhatsApp account into an API.
In addition, whatsapp-api-nodejs can π€―:
To get started clone the repository from Github:
git clone https://github.com/salman0ansari/whatsapp-api-nodejs.git
Change directory into the project and run
npm install
It will take some time to install the dependencies.
If you going to use webhook make sure to create a .env
file in the project root. Inside the file add:
WEBHOOK_URL=https://your webhook url
Finally, run npm run start
in the project root to start the server. Our applications will be accessed at
http://localhost:3333
To initialise a server make a GET request Note: Donβt forgot to save KEY value.
ENDPOINT: /init
To scan QR code make a GET request
ENDPOINT: /qrcode?key=KEY
QUERY -> KEY = Instance Key
Note: make sure to scan QR ASAP after you init a Instance.
To send a Text message make a POST request
ENDPOINT: /sendText?key=KEY
QUERY -> KEY = Instance Key
REQUEST BODY:
{
"msg_data": {
"id": "919999999999",
"message": "Hello World"
}
}
To check more enpoint make a GET request
ENDPOINT: /api-docs