This is a fully customizable WhatsApp chatbot built using Twilio, OpenAI, and Pinecone, allowing users to configure conversation flows, FAQs, and API integrations via a simple JSON-based setup.
β
Customizable Flow: Define your chatbotβs conversation flow in flow.json
.
β
AI-Powered FAQ Search: Uses Pinecone vector search for fast, relevant responses.
β
Real-time API Calls: Fetch dynamic data from external APIs, configurable in flow.json
.
β
OpenAI Fallback: If no FAQ match is found, AI generates a response.
β
WhatsApp-Ready: Built for Twilio WhatsApp API, instantly deployable.
β
State Management: Uses Redis for seamless conversation tracking.
β
Zero Code Changes Needed: Just update JSON files & run the bot!
git clone https://github.com/your-username/whatsapp-chatbot.git
cd whatsapp-chatbot
npm install
Create a .env
file with:
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone
OPENAI_API_KEY=your_openai_api_key
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=faqs
REDIS_URL=your_redis_url
PORT=3000
Modify flow.json
to customize the chatbot:
{
"welcome": {
"type": "plain",
"message": "Welcome to our chatbot! How can I help?",
"next": "main"
},
"main": {
"type": "branch",
"branches": [
{ "condition": "1", "next": "propertySearch" },
{ "condition": "2", "next": "faqNode" },
{ "condition": "3", "next": "support" }
]
},
"propertySearch": {
"type": "api",
"message": "Searching for properties...",
"api": {
"url": "https://api.example.com/properties",
"method": "GET",
"params": ["city", "budget"]
},
"next": "closingNode"
},
"faqNode": {
"type": "faq",
"next": "main"
},
"support": {
"type": "plain",
"message": "Contact support at support@example.com",
"next": "main"
}
}
[
{
"id": "faq_1",
"question": "What is ZeroDeposit Rental?",
"answer": "ZeroDeposit replaces traditional security deposits with a financial guarantee."
},
{
"id": "faq_2",
"question": "How much does the Rental Guarantee cost?",
"answer": "The guarantee fee is 9% of the deposit amount."
}
]
node upload_faqs.js
node bot.js
- Go to Twilio Console β Messaging β WhatsApp Senders
- Set Webhook URL:
https://your-server.com/webhook
- Method:
POST
- Save and Test by sending a message to your Twilio number.
- Deploy on Railway.app
- Add Environment Variables from
.env
- Deploy & Start the Bot!
- Push Code to GitHub
- Deploy on Render.com
- Expose Webhook
Run using PM2:
npm install -g pm2
pm2 start bot.js --name whatsapp-bot
pm2 save
- β Multi-language Support (Use OpenAI translation)
- β Analytics Dashboard (Track chatbot performance)
- β Webhook Event Logging (Monitor responses)
Feel free to fork, modify, and submit PRs! Let's build smarter chatbots together. π
π Built with β€οΈ using OpenAI, Twilio & Pinecone. π