WhatsApp Chatbot with Node.js and Whatsapp.js
Make sure to install the dependencies:
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
Start the development server on http://localhost:8000
:
Or you can edit this line of code to change port
// initial instance
const PORT = process.env.PORT || 8000;
- After installation, run the app with
# npm
npm run start
# pnpm
pnpm run start
# yarn
yarn start
- Wait until QR code shown at
http://localhost:8000
and scan with your phone to login whatsapp - To send message, use this
CURL
. Modifyphone
for target phone number andmessage
for message you want to send
curl --location 'http://localhost:8000/send' \
--header 'Content-Type: application/json' \
--data-raw '{
"phone": "[email protected]",
"message": "Test Send Message"
}'