A WhatsApp chatbot that handles user registration through a conversational interface.
- Step-by-step registration process
- Data validation for email and dates
- MongoDB integration for data storage
- WhatsApp Cloud API integration
- Error handling and user feedback
- Node.js (v14 or higher)
- MongoDB
- WhatsApp Business API account
- Facebook Developer account
- Clone the repository:
git clone <repository-url>
cd whatsapp-chatbot- Install dependencies:
npm install- Create a
.envfile in the root directory with the following variables:
PORT=3000
MONGODB_URI=mongodb://localhost:27017/whatsapp-chatbot
WHATSAPP_TOKEN=your_whatsapp_token_here
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id_here
VERIFY_TOKEN=your_verify_token_here
-
Set up WhatsApp Business API:
- Create a Facebook Developer account
- Set up a WhatsApp Business API account
- Get your WhatsApp token and phone number ID
- Configure your webhook URL
-
Start the server:
npm startFor development with auto-reload:
npm run dev- Users can start the registration process by sending any message to your WhatsApp business number
- The bot will guide them through the registration process step by step
- Each step includes validation and error handling
- The registration data is stored in MongoDB
- Welcome message and start confirmation
- Company name
- Business license number
- Registration date
- Primary contact name
- Email address
- Username
- Password
- Password confirmation
- Phone number
- Website (optional)
- Street address
- City
- Completion message
- In production, implement proper password hashing
- Add rate limiting
- Implement session management
- Add input sanitization
- Use HTTPS for webhook endpoints
- Implement proper error handling and logging
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License.