We've made several important improvements to the bot:
-
Improved Error Handling:
- Fixed template not found errors in admin views
- Proper error messages when accessing non-existent resources
- Graceful handling of calendar API errors
-
Enhanced Conversation Flow:
- Added "reset" command to restart conversations at any point
- Improved natural language understanding for availability inputs
- Better error recovery in the conversation flow
-
Admin Dashboard Improvements:
- Redesigned interview details page with clear sections for interview, candidate, and recruiter information
- Better spacing and organization of action buttons
- Fixed calendar event cancellation functionality
-
Database Stability:
- Fixed database initialization to preserve existing data
- Improved schema to properly track calendar events
- Better handling of database connections
-
Calendar Integration:
- Fixed email notification issues for recruiters
- Added proper scopes for Google Calendar API
- Improved handling of calendar event creation and deletion
-
User Experience:
- Cleaner interview confirmation messages
- More intuitive error messages
- Better guidance throughout the scheduling process
This project was developed for the BasisVectors Hackathon, addressing the challenge of streamlining the interview scheduling process. Our solution automates the entire workflow from initial candidate contact to calendar invitation, saving recruiters countless hours and improving candidate experience.
As part of the BasisVectors Hackathon requirements, a presentation (PowerPoint/slides) must be submitted alongside the working solution. The presentation should include:
- Problem Statement: The inefficiency of traditional interview scheduling processes
- Solution Overview: How our WhatsApp bot addresses these challenges
- Key Features: Highlighting the main capabilities of our solution
- Technical Architecture: Simplified diagrams of how the system works
- Demo Screenshots: Visual examples of the bot in action
- Implementation Details: Brief overview of technologies used
- Challenges & Solutions: Problems encountered and how we solved them
- Future Enhancements: How the solution could be improved further
- Team Information: Contributors and their roles
The presentation should be concise (10-15 slides) but comprehensive, focusing on both the technical implementation and the business value of the solution.
The BasisVectors Hackathon challenged us to solve a critical problem in the recruitment process: the inefficient and time-consuming nature of interview scheduling. Recruiters spend hours coordinating with candidates through multiple back-and-forth communications, leading to delays, errors, and poor candidate experience.
We built an AI-powered WhatsApp bot that revolutionizes the interview scheduling process by:
- Automating candidate interactions through natural language conversations
- Intelligently parsing availability preferences
- Seamlessly integrating with Google Calendar
- Providing a comprehensive admin dashboard for recruiters
- Conversational AI Interface: Candidates interact with a friendly, intuitive WhatsApp bot that feels like texting a human recruiter
- Seamless Scheduling Flow: From initial greeting to calendar invitation in minutes, not days
- Context-Aware Conversations: The bot remembers user information and maintains conversation context
- Error-Tolerant Interactions: Intelligent handling of unexpected inputs with helpful guidance
- Real-Time Calendar Integration: Automatic checking of availability and instant scheduling
- Admin Control Center: Comprehensive dashboard for recruiters to manage the entire process
-
Conversation Management System
- State machine architecture for tracking conversation progress
- Context preservation across multiple messages
- Natural language understanding for intent recognition
-
Availability Parser
- Custom NLP engine for interpreting time expressions (e.g., "Monday afternoon between 2-4pm")
- Validation logic to ensure parsed times are valid
- Conversion of natural language to structured datetime objects
-
Calendar Integration
- OAuth2 authentication with Google Calendar
- Automatic slot generation based on availability
- Calendar event creation with proper metadata
- Email notification system for calendar invitations
-
Database Architecture
- Relational schema for candidate, recruiter, and interview data
- Conversation state persistence
- Transaction management for data integrity
-
Admin Interface
- Real-time dashboard for interview monitoring
- Calendar connection management
- Candidate information access
- Interview status tracking
-
Programming Languages:
- Python (Backend logic)
- HTML/CSS/JavaScript (Frontend dashboard)
- SQL (Database queries)
-
Frameworks & Libraries:
- Flask (Web application framework)
- SQLAlchemy (ORM for database interactions)
- Google API Client (Calendar integration)
- Twilio API (WhatsApp messaging)
- Jinja2 (Template engine)
-
Database:
- SQLite (Development)
- Relational schema design
-
AI & NLP Components:
- Custom NLP logic for parsing availability
- State machine for conversation flow
- Context management techniques
- Pattern recognition for entity extraction
-
Integrations:
- Twilio WhatsApp API
- Google Calendar API
- Email notification system
-
Deployment:
- Containerized application
- Environment variable configuration
- Webhook setup for real-time messaging
- Ngrok for local webhook tunneling
- Overview
- Key Features
- Technical Architecture
- AI & ML Implementation
- User Flow
- Installation & Setup
- Configuration
- Usage Guide
- API Documentation
- Future Enhancements
- Challenges & Solutions
- Team
- License
The Interview Scheduling Bot is an AI-powered WhatsApp bot that automates the interview scheduling process. It engages candidates in natural conversation, collects their information, availability preferences, and automatically schedules interviews by integrating with Google Calendar. The system includes an admin dashboard for recruiters to manage interviews and candidates.
Scheduling interviews is a time-consuming process that involves multiple back-and-forth communications between recruiters and candidates. This process is prone to errors, miscommunications, and delays, resulting in a poor candidate experience and inefficient use of recruiters' time.
We've developed an intelligent WhatsApp bot that handles the entire scheduling process, from initial contact to calendar invitation. The bot uses natural language processing to understand candidate availability, integrates with Google Calendar to find suitable slots, and automatically sends calendar invitations to both parties.
- Natural Language Interaction: Engage with candidates using everyday language
- Guided Conversation Flow: Step-by-step guidance through the scheduling process
- Context Awareness: Maintains conversation context across multiple messages
- Error Recovery: Intelligent handling of unexpected inputs with helpful prompts
- Availability Parsing: Understands natural language time expressions (e.g., "Monday 2pm-4pm")
- Smart Slot Generation: Creates appropriate interview slots based on availability
- Calendar Integration: Connects with Google Calendar for real-time availability checking
- Automated Invitations: Sends calendar invitations to all participants
- Interview Management: View, manage, and track all scheduled interviews
- Candidate Management: Access candidate information and history
- Calendar Controls: Connect/disconnect Google Calendar integration
- Status Tracking: Monitor interview status (scheduled, completed, cancelled)
- Calendar Event Creation: Create calendar events directly from the dashboard
- Unique Candidate Tracking: Maintains separate records for each candidate
- Shared Phone Number Support: Works correctly even when multiple users share a device
- Conversation State Management: Keeps track of where each user is in the process
The application follows a service-oriented architecture with clear separation of concerns:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β WhatsApp API ββββββΆβ Flask Backend ββββββΆβ Google Calendarβ
β (Twilio) β β (Python) β β API β
β β β β β β
βββββββββββββββββββ ββββββββββ¬βββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β β
β SQLite Databaseβ
β β
βββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β β
β Admin Dashboardβ
β (Flask/Jinja) β
β β
βββββββββββββββββββ
- State Machine: Tracks conversation progress through defined states
- Context Management: Stores and retrieves user information throughout the conversation
- Message Handling: Processes incoming messages and generates appropriate responses
- Intent Recognition: Identifies user intentions from message content
- Entity Extraction: Pulls out key information like names, emails, and times
- Availability Parsing: Converts natural language time expressions into structured data
- Google Calendar API: Connects to users' calendars for availability checking
- OAuth Authentication: Secure connection to Google services
- Event Creation: Automatically creates calendar events for interviews
- Candidate Storage: Maintains records of all candidates and their information
- Interview Tracking: Stores details of all scheduled interviews
- Conversation State Persistence: Saves conversation state between messages
- Dashboard: Provides overview of scheduling activity
- Interview Management: Tools for viewing and managing interviews
- Calendar Configuration: Interface for connecting Google Calendar
- Model-View-Controller (MVC): Separates data, presentation, and control logic
- Service-Oriented Architecture: Modular services with clear responsibilities
- State Machine Pattern: For conversation flow management
- Repository Pattern: For data access abstraction
- Dependency Injection: For service composition
- Custom NLP Logic: Hand-crafted rules for parsing availability
- Pattern Recognition: For identifying dates, times, and commands
- Context Management: AI techniques for maintaining conversation context
- State-based Dialogue Management: Tracks conversation progress and guides users
- Error Handling: Intelligent recovery from unexpected inputs
- Context Preservation: Maintains conversation context across multiple messages
- Natural Language Time Understanding: Converts expressions like "Monday 2pm-4pm" into structured datetime objects
- Validation Logic: Ensures parsed times are valid and within acceptable ranges
- Fuzzy Matching: Handles variations in time format specifications
- Initial Contact: Candidate messages the WhatsApp number
- Information Collection: Bot collects name, email, and position
- Availability Sharing: Candidate shares their availability in natural language
- Slot Selection: Bot presents available slots and candidate selects one
- Confirmation: Candidate confirms the selected slot
- Calendar Invitation: Candidate receives a calendar invitation via email
- Dashboard Access: Recruiter logs into the admin dashboard
- Interview Overview: Views all scheduled interviews
- Calendar Connection: Connects their Google Calendar
- Interview Management: Views, manages, and tracks interview status
- Calendar Integration: Interviews appear on their Google Calendar
- Python 3.8+
- Flask
- SQLAlchemy
- Google API Client Library
- Twilio API Client
- A Twilio account with WhatsApp integration
- A Google account with Calendar API access
-
Clone the repository
git clone https://github.com/yourusername/scheduling-bot.git cd scheduling-bot -
Create and activate a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Initialize the database
python init_db.py
-
Set up environment variables Create a
.envfile with the following variables:FLASK_APP=run.py FLASK_ENV=development TWILIO_ACCOUNT_SID=your_twilio_sid TWILIO_AUTH_TOKEN=your_twilio_token TWILIO_PHONE_NUMBER=your_twilio_whatsapp_number GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret -
Run the application
python run.py
-
Set up Twilio webhook
- In your Twilio console, set the WhatsApp webhook URL to
https://your-domain.com/webhook - For local development, use ngrok to expose your local server:
ngrok http 8080 # Replace 8080 with your application port - Copy the HTTPS URL provided by ngrok (e.g., https://a1b2c3d4.ngrok.io)
- Set this URL + "/webhook" as your Twilio WhatsApp webhook URL
- Ngrok URLs change each time you restart ngrok unless you have a paid account
- In your Twilio console, set the WhatsApp webhook URL to
- Go to the Google Cloud Console
- Create a new project
- Enable the Google Calendar API
- Create OAuth 2.0 credentials
- Download the client secret JSON file and save it as
client-secret.jsonin the project root
- Sign up for a Twilio account
- Activate the WhatsApp sandbox
- Configure the webhook URL to point to your
/webhookendpoint:- For production: Use your domain (https://your-domain.com/webhook)
- For development: Use ngrok to create a secure tunnel to your local server
ngrok http 8080 # Replace 8080 with your application port
- In the Twilio console, set the webhook URL to your ngrok HTTPS URL + "/webhook"
- Test the connection by sending a message to your Twilio WhatsApp number
- The admin dashboard is available at
/admin - Default credentials are created during database initialization
- Connect your Google Calendar by clicking "Connect Google Calendar" in the dashboard
- Send "hi" or "hello" to the WhatsApp number
- Follow the bot's prompts to provide your information
- Share your availability in natural language (e.g., "Monday 2pm-4pm, Tuesday 10am-12pm")
- Select an available slot by replying with the number
- Confirm your selection by replying "yes"
- Check your email for the calendar invitation
- Log in to the admin dashboard
- Connect your Google Calendar
- View scheduled interviews on the dashboard
- Click on an interview to see details
- Use the dashboard to manage interviews (mark as completed, cancel, etc.)
- Create calendar events for interviews that don't have them
- URL:
/webhook - Method: POST
- Description: Receives WhatsApp messages from Twilio
- Parameters:
From: The sender's WhatsApp numberBody: The message content
- GET
/admin/: Admin dashboard - GET
/admin/interviews: List all interviews - GET/POST
/admin/interviews/<id>: View/update interview details - GET
/admin/candidates: List all candidates - GET
/admin/recruiters: List all recruiters - GET/POST
/admin/recruiters/add: Add a new recruiter
- GET
/authorize: Start OAuth flow - GET
/oauth2callback: Handle OAuth callback - GET
/revoke: Revoke calendar access
- Enhanced NLP: Integrate with a more sophisticated NLP service
- Multi-language Support: Add support for multiple languages
- SMS Fallback: Add SMS support for users without WhatsApp
- Customizable Templates: Allow recruiters to customize message templates
- Reminder Notifications: Send reminders before scheduled interviews
- Bulk Interview Scheduling: Support for scheduling multiple interviews at once
- AI-powered Scheduling Optimization: Use machine learning to optimize interview scheduling
- Integration with ATS Systems: Connect with Applicant Tracking Systems
- Candidate Feedback Collection: Collect feedback after interviews
- Analytics Dashboard: Provide insights on scheduling patterns and efficiency
- Mobile App: Develop a mobile app for recruiters
- Multiple Timezone Support: Better handling of different timezones
Problem: WhatsApp messages are stateless, making it difficult to maintain conversation context. Solution: Implemented a robust state management system using a database to track conversation state and context.
Problem: Understanding various formats of time expressions in natural language. Solution: Developed a custom time parsing system that can handle different formats and variations.
Problem: OAuth flow requires HTTPS, which is challenging in development environments. Solution: Implemented a development mode that allows OAuth to work with HTTP for testing, with clear warnings about production security.
Problem: Multiple candidates using the same phone number caused data conflicts. Solution: Modified the database schema and conversation handling to support multiple candidates with the same phone number.
Problem: Recruiters were not receiving email notifications when interviews were scheduled. Solution: Updated the Google Calendar API scopes and parameters to ensure proper email notifications are sent.
Problem: Database schema was being reset on each application restart, causing data loss. Solution: Modified the database initialization process to only create tables if they don't exist, preserving existing data.
- Karan Sahota - Full Stack Developer & Project Lead (Primary Contributor)
- Pratham Malviya - Documentation & Testing
- S Praneeth Nanabolu - UI/UX Design Support
This project is licensed under the MIT License - see the LICENSE file for details.
- BasisVectors for organizing the hackathon
- Twilio for the WhatsApp API
- Google for the Calendar API
- All the mentors and judges who provided guidance and feedback
This project was created during the BasisVectors Hackathon 2025.