WhatsApp Cab Booking Bot is a Node.js project designed for booking cabs from WhatsApp. It includes two sections: one for users who can book cabs via chat on WhatsApp, and another for owners who can use commands to confirm, cancel, or view all bookings.
Users can effortlessly book cabs via chat on the WhatsApp bot by selecting available options, making the cab booking process more user-friendly.
Owners are equipped with specific commands that can be sent as messages to the WhatsApp bot, enabling them to manage bookings efficiently. The available commands include:
Show Single Bookings:
"show booking"
or "show bookings"
Mark Booking as Complete:
"complete"
Additionally, other commands are option-based and can be selected as needed:
Owners can use these commands to interact with the WhatsApp bot and stay informed about bookings or mark them as completed.
Ask for Name and Save
Ask for Local or Outstation
Ask for Day or Night
Ask for One-way or Return:
Ask for Charges/Booking:
Ask for Pickup Location
Ask for Drop Location
Ask for Date
Ask for Time
Confirm the Booking:
Thank You Message and "Cancel" Option
Select Option:
When a user books a cab, the system follows a confirmation process involving the owner. The booking goes through the following stages:
User Books Cab:
Message Sent to Owner:
Owner Confirmation:
This confirmation process ensures that the cab is only fully booked when the owner confirms the user's booking request.
1 - PENDING 2 - CONFIRMED 3 - CANCELLED 4 - COMPLETED
Scan the displayed QR code with your WhatsApp mobile app.
This project utilizes the following technologies and dependencies:
whatsapp-web.js
: Library for interacting with WhatsApp Web. GitHub Repositoryqrcode
: Library for generating QR codes for authentication.axios
: Promise-based HTTP client for making requests.user_db
: ORM module for managing user data.user_ride_db
: ORM module for handling user ride information.owner_db
: ORM module for managing owner data.rate_card_db
: ORM module for rate card information.user_state
: Module for managing user state in the booking process.r_funcs
: Reusable functions for various functionalities.ed
: Encoder and decoder module for encoding and decoding messages.moment
: Library for parsing, validating, manipulating, and displaying dates.dotenv
: Module for loading environment variables from a .env
file.mysql2
: Promise-based MySQL library for database interactions.node-cron
: Module for scheduling cron jobs in Node.js.format
(from mysql2/promise
): Function for SQL query formatting.admin_state
: Module for managing the state of the admin.git clone https://github.com/codeterrayt/WhatsAppCabBookingBot.git
cd WhatsAppCabBookingBot
npm install
node index.js
Scan the displayed QR code with your WhatsApp mobile app.
WhatsApp Cab Booking Bot
Feel free to contribute to the project by submitting issues or pull requests.
Happy cab booking! 🚗✨