A production-ready Node.js WhatsApp chatbot built with NestJS, leveraging the WhatsApp Cloud API for direct integration with WhatsApp, GPT-4o for conversational intelligence and Redis (free tier from Upstash) for context management.
For a detailed, step-by-step guide on building this chatbot, check out:
Key Features:
- GPT-4o Integration: Utilises the advanced capabilities of GPT-4o for natural language understanding and generation, ensuring engaging and intelligent conversations.
- Text-To-Image Generation: Utilises Stability AI's
Stable Diffusionmodel for text-to-image generation. - Redis for Context: Stores conversation context in Redis, enabling the chatbot to maintain a cohesive dialogue and provide context-aware responses.
- NestJS Framework: Built on the robust and scalable NestJS framework, providing a well-structured and maintainable codebase.
- Production-Ready: Designed with production environments in mind, ensuring security, stability, scalability, and reliability.
Getting Started:
-
Install Node.js: Download and install the latest version of Node.js from https://nodejs.org/.
-
Install Dependencies:
npm install
-
Configure Environment Variables:
- Set up environment variables for API keys (OpenAI, WhatsApp API provider), database credentials (Redis), and other necessary configurations.
-
Run the Chatbot:
-
Development Mode:
npm run start:dev
This command starts the chatbot in development mode with file watching for changes.
-
Debug Mode:
npm run start:debug
This command starts the chatbot in debug mode with file watching for changes, enabling you to use a debugger.
-
Production Mode:
npm run start:prod
This command starts the chatbot in production mode, optimized for performance and stability.
-
- No third-party providers needed! You can directly integrate with the WhatsApp Cloud API by following these steps:
- Create a Facebook Developer account at https://developers.facebook.com/.
- Create a WhatsApp Business account and integrate it with your Facebook Developer account.
- Follow the official WhatsApp Cloud API documentation to configure your chatbot. (details to be saved to your environment file)
Testing (Contributions are welcome - running by grace, no tests):
-
Unit Tests:
npm run test -
End-to-End (E2E) Tests:
npm run test:e2e
Support and Contribution:
We welcome contributions and feedback. If you encounter issues or have suggestions, please open an issue on GitHub.
Acknowledgements:
This chatbot is made possible by the incredible work of the following projects:
Join the Conversation:
More features to be added to the chatbot, stay in the loop:
Let's build a smarter and more engaging WhatsApp experience!


