A robust WhatsApp bot that automates handling of WordPress form submissions, instantly engaging users, confirming their details, forwarding leads to admins, and sending email notifications. Built with Node.js, Express, and whatsapp-web.js.
- WhatsApp Integration: Receives and replies to messages, sends payment links, and answers user queries.
- WordPress Webhook Support: Receives form submissions via POST requests.
- Automated Confirmation: Asks users to confirm details and guides them through payment.
- Admin Notification: Forwards new leads/orders to admin WhatsApp.
- Email Notification: Sends formatted emails via Resend API.
- Multi-plan Payment Links: Dynamically generates payment URLs based on user selection (duration/connections).
- Health/Test Endpoints: Check bot/server status easily.
- Environment Variable Driven: Configure secrets and deployment settings securely.
- Node.js
- Express
- whatsapp-web.js
- qrcode-terminal
- dotenv
- axios
- Clone the Repo
git clone <your-repo-url> cd wordpress-wa-bot
- Install Dependencies
npm install
- Configure Environment
- Create a
.envfile:RESEND_API_KEY=your_resend_api_key CLIENT_EMAIL=your_notification_email PUPPETEER_EXECUTABLE_PATH=path_to_chromium (optional)
- Create a
- Start the Bot
npm start
- Scan the WhatsApp QR Code
- On first run, scan the QR code in your terminal with your WhatsApp app.
- POST
/api/form-data- Expects:
name,phone,email,offer,connections,page_url - Triggers WhatsApp and email notifications.
- Expects:
- Integrate with your WordPress form to POST data to the bot's
/api/form-dataendpoint. - Users receive WhatsApp confirmation and payment instructions.
- Admin gets notified of new leads/orders on WhatsApp and email.
npm start— Run the botnpm run dev— Run in development mode
See package.json for full list:
- express
- whatsapp-web.js
- qrcode-terminal
- dotenv
- axios
- body-parser
- Aditya
- [Your GitHub profile link or contact]
This project is licensed under the ISC License.