WhatsApp Chatbot (Ultimate Edition v3.0)

Advanced Python Flask Chatbot with Multilingual Support (Hindi/English), Broadcasting, Admin Dashboard, Sentiment Analysis, and Booking Management
View Interactive Demo

📖 Project Overview

WhatsApp Chatbot (Ultimate Edition v3.0) is a comprehensive, production-ready solution designed for businesses to automate customer engagement on WhatsApp. Built with Python 3.10+, Flask, and Twilio, this project goes beyond simple auto-replies to offer a full-fledged Business Communication Platform.

Unlike basic bots, this system features Intelligent State Management for complex bookings, Sentiment Analysis (using TextBlob) to prioritize urgent queries, Fuzzy Matching (using TheFuzz) to handle typos, Multilingual Support (Hindi/English), and a robust Admin Dashboard with real-time analytics, broadcasting, and CSV export capabilities.

⚡ Quick Facts

🎯 Type: Business AI Chatbot
🐍 Backend: Python 3.10+ (Flask)
🔌 Integration: Twilio API
⚡ Latency: Real-time (< 200ms)
📊 Dashboard: Included (Bootstrap 5)
📦 Database: JSON / CSV (Portable)
🧠 AI Features: NLP (TextBlob), Sentiment Analysis, Fuzzy Matching (TheFuzz)
🌍 Languages: Hindi + English (Bilingual Support)
100%
Python Code
2
Languages
5
Knowledge Base Services
Zero
SQL Required
Developer: RSK World | Website: rskworld.in | Email: info@rskworld.com
Difficulty Level: Intermediate to Advanced - Requires understanding of Python, APIs, and Webhooks.

✨ Key Features

🤖 Intelligent Chat Logic

🌍 Multilingual Support

Seamlessly switch between Hindi and English using hindi or english commands. The bot maintains language context throughout the conversation.

🧠 Sentiment & Urgency Detection

Powered by TextBlob, the bot analyzes user mood (Positive/Negative/Neutral) and detects urgency keywords (e.g., "urgent", "emergency", "asap") to flag conversations for immediate admin attention.

🌫️ Fuzzy Matching

Corrects user typos automatically (e.g., understands "boking" as "booking") using TheFuzz library with 70% similarity threshold for intelligent command matching. Also includes knowledge base search for service queries.

📚 Knowledge Base

Built-in service descriptions for web, chatbot, ai, marketing, and seo. Users can query specific services and get detailed information automatically.

🚨 Urgency Detection

Automatically detects urgent keywords like "urgent", "emergency", "asap", "immediate", or "broken" and flags conversations for immediate admin attention.

📅 Smart Booking System

A multi-step state machine (BOOKING_NAME → BOOKING_DATE → BOOKING_TOPIC) guides users through scheduling appointments, capturing name, date, and topic naturally with contextual memory.

📊 Admin Power Tools

📈 Real-time Analytics

Monitor user sentiment trends, daily interaction counts, and popular intent categories via Chart.js visualizations.

📢 Broadcast System

Send marketing messages or announcements to all subscribed users directly from the dashboard via the /api/broadcast endpoint.

📥 CSV Export

Download all appointment bookings and user logs as CSV files via /api/export_bookings endpoint for one-click integration with Excel/Google Sheets.

🛡️ Booking Watchtower

Admin dashboard provides centralized view of all customer appointments with timestamp, name, phone, date, and topic for easy management.

🏗️ System Architecture

The solution is designed with modularity in mind, separating the core bot logic from the API layer.

Bot Core (bot_logic.py)

Handles the state machine, NLP processing, and session management. It is purely functional and framework-agnostic.

API Gateway (app.py)

Flask endpoints that handle incoming Webhooks from Twilio, serve the Admin UI, and manage API routes.

Data Layer (JSON)

NoSQL flat-file storage for bookings and analytics. Ensures zero-setup deployment and easy backups.

📦 Installation Guide

⏱️ Setup Time: ~5 minutes

Requires Python 3.10+ installed on your system.

🚀 Quick Start

Step 1: Install Dependencies
pip install -r requirements.txt
python -m textblob.download_corpora
Step 2: Run Application
python app.py

✅ Server Running!

Access your interfaces at:

🔧 Connecting to WhatsApp (Twilio)

To make the bot public or test with real WhatsApp:

  1. Use Ngrok to expose your local server: `ngrok http 5000`
  2. Copy the HTTPS URL (e.g., `https://abc.ngrok.io`)
  3. Go to Twilio Console > Messaging > Sandbox Settings
  4. Set the "When a message comes in" webhook to: `https://abc.ngrok.io/webhook`

📚 Usage Guide

💬 Chat Commands

Try these inputs in the bot:

  • hi / hello / start - Start conversation and show main menu
  • hindi - Switch to Hindi language
  • english - Switch back to English
  • 1 or services - View our services
  • 2 or booking / consultation - Start appointment booking flow
  • 3 or contact - Get contact information
  • 4 or about - Learn about RSK World
  • 5 or joke / funny - Get a random joke
  • web / chatbot / ai / marketing / seo - Learn about specific services
  • urgent / emergency - Test urgency detection
  • reset - Clear session memory and restart

🧠 Knowledge Base Services

The bot has a built-in knowledge base for these topics. Try asking about:

  • web - Web Development services
  • chatbot - Custom Chatbot solutions
  • ai - AI Solutions and services
  • marketing - Digital Marketing strategies
  • seo - SEO optimization services

📊 Dashboard Features

  • View Bookings: See all collected appointment data in a table with timestamp, name, phone, date, and topic.
  • Export CSV: Click "Export CSV" button to download all booking data as CSV file via /api/export_bookings endpoint.
  • Real-time Analytics: View sentiment distribution (Positive/Neutral/Negative) via Chart.js doughnut chart.
  • Total Interactions: Track overall system usage metrics displayed in real-time.
  • Recent Activity: View last 5 user intents and interactions in the activity feed.
  • Send Broadcast: Use the "Broadcast" modal to send messages to all users via /api/broadcast endpoint (simulated in demo).

💬 Support & Contact

📞 Get Help

Need assistance with the WhatsApp Chatbot? We're here to help! Reach out to us through any of the following channels:

Email Support

Primary Email: info@rskworld.com

Support Email: support@rskworld.com

For technical questions, bug reports, or feature requests, email us and we'll respond within 24-48 hours.

Phone Support

Phone: +91 93305 39277

Call us for immediate assistance with setup, integration, or custom development needs.

Available: Monday - Saturday, 9:00 AM - 6:00 PM IST

Website

Visit: rskworld.in

Explore more projects, tutorials, and resources on our website.

Location

Address: Nutanhat, Mongolkote
West Bengal, India

For in-person consultations or business meetings, contact us to schedule an appointment.

❓ Frequently Asked Questions

How do I set up Twilio?

1. Create a Twilio account at twilio.com
2. Get your Account SID and Auth Token
3. Set up WhatsApp Sandbox or get approved for production
4. Configure webhook URL in Twilio Console
5. Update environment variables in your project

Can I customize the bot responses?

Yes! All bot responses are in bot_logic.py. You can modify the MENU_TEXT, HINDI_STRINGS, SERVICES, and JOKES dictionaries to customize the bot's behavior.

How do I add more languages?

Add a new language dictionary similar to HINDI_STRINGS in bot_logic.py, then update the language switching logic to support your new language.

Can I use a database instead of JSON?

Absolutely! The project uses JSON for simplicity, but you can easily replace it with SQLite, PostgreSQL, MongoDB, or any other database. Just modify the save_booking() and load_bookings() functions.

How do I deploy to production?

The project includes a Procfile for Heroku deployment. You can also deploy to AWS, Google Cloud, Azure, or any Python hosting service. Make sure to set environment variables for Twilio credentials.

Is this project free to use?

Yes! This project is open-source and free to use for both personal and commercial projects. Check the LICENSE file for details. We appreciate credits and contributions!

🔧 Technical Support

Common Issues & Solutions

  • Import errors: Make sure all dependencies are installed: pip install -r requirements.txt
  • TextBlob errors: Download NLTK corpora: python -m textblob.download_corpora
  • Twilio webhook not working: Ensure your server is publicly accessible (use Ngrok for local testing)
  • Port already in use: Change the port in app.py or kill the process using port 5000
  • JSON file errors: Ensure bookings.json and analytics.json are writable

🤝 Contributing & Custom Development

Custom Features

Need custom features like payment integration, CRM connections, or advanced AI? Contact us for custom development services.

Bug Reports

Found a bug? Email us at support@rskworld.com with details about the issue, steps to reproduce, and your environment setup.

Feature Requests

Have an idea for a new feature? We'd love to hear it! Send your suggestions to info@rskworld.com

Training & Consultation

Need help understanding the codebase or want training for your team? We offer consultation services. Contact us for pricing.

Thank You!

Thank you for using WhatsApp Chatbot! If you find this project helpful, please consider:

  • ⭐ Starring the project on GitHub
  • 📢 Sharing it with others
  • 🐛 Reporting bugs and issues
  • 💡 Suggesting improvements
  • 💝 Supporting the project