{"id":21978139,"url":"https://github.com/codeterrayt/whatsappcabbookingbot","last_synced_at":"2025-04-28T16:48:27.115Z","repository":{"id":219575877,"uuid":"749369296","full_name":"codeterrayt/WhatsAppCabBookingBot","owner":"codeterrayt","description":"WhatsApp Cab Booking Bot is a Node.js project for easy cab reservations via WhatsApp. It features user-friendly booking for passengers and convenient command-based management for owners. Enhance the cab booking experience with this streamlined solution in the familiar WhatsApp interface.","archived":false,"fork":false,"pushed_at":"2025-03-09T13:53:51.000Z","size":80,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T11:32:40.327Z","etag":null,"topics":["automation","booking-system","bot","cab-booking","chatbot","interactive","javascript","nodejs","open-source","whatsapp","whatsapp-bot","whatsapp-web-js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeterrayt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-28T11:39:16.000Z","updated_at":"2025-03-10T12:18:29.000Z","dependencies_parsed_at":"2024-06-22T22:24:38.863Z","dependency_job_id":"7c19859c-2baf-4a80-9e31-de0fd2635788","html_url":"https://github.com/codeterrayt/WhatsAppCabBookingBot","commit_stats":null,"previous_names":["codeterrayt/whatsappcabbookingbot"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeterrayt%2FWhatsAppCabBookingBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeterrayt%2FWhatsAppCabBookingBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeterrayt%2FWhatsAppCabBookingBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeterrayt%2FWhatsAppCabBookingBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeterrayt","download_url":"https://codeload.github.com/codeterrayt/WhatsAppCabBookingBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251348387,"owners_count":21575268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","booking-system","bot","cab-booking","chatbot","interactive","javascript","nodejs","open-source","whatsapp","whatsapp-bot","whatsapp-web-js"],"created_at":"2024-11-29T16:18:06.831Z","updated_at":"2025-04-28T16:48:27.107Z","avatar_url":"https://github.com/codeterrayt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WhatsApp Cab Booking Bot 🚗✨\n\nWhatsApp 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.\n\n# OUTPUT \n\n\nhttps://github.com/user-attachments/assets/03c161b2-9642-487a-bdb1-fc3fd60c3079\n\n\n\n## User Section\n\nUsers can effortlessly book cabs via chat on the WhatsApp bot by selecting available options, making the cab booking process more user-friendly.\n\n## Owner Section\n\nOwners 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:\n\n\n#### Owner Commands\n\n- **Show Single Bookings:**\n  - Command: `\"show booking\"` or  `\"show bookings\"`\n  - Description: View a list of all current bookings.\n\n- **Mark Booking as Complete:**\n  - Command: `\"complete\"`\n  - Description: Mark a booking as complete, indicating that the service has been provided.\n  \n  \nAdditionally, other commands are option-based and can be selected as needed:\n\n- **Option-based Commands:**\n  - Owners can choose from a set of options provided by the bot for specific actions.\n\nOwners can use these commands to interact with the WhatsApp bot and stay informed about bookings or mark them as completed.\n\n\n\n\n## User Booking Process Flow\n\n0. **Ask for Name and Save**\n   - Gather user information and save the name.\n\n1. **Ask for Local or Outstation**\n   - Prompt the user to choose between a local or outstation ride.\n\n2. **Ask for Day or Night**\n   - Inquire whether the user prefers a day or night journey.\n\n3. **Ask for One-way or Return:**\n    - 1: Proceed to Step 5 for one-way details.\n    - 2: Move to Step 4 for return journey details.\n\n4. **Ask for Charges/Booking:**\n    - 1: Display the rate card to the user.\n    - 2: Continue to Step 5 to finalize the booking.\n\n5. **Ask for Pickup Location**\n   - Collect information about the pickup location.\n\n6. **Ask for Drop Location**\n   - Obtain details about the drop-off location.\n\n7. **Ask for Date**\n   - Prompt the user to specify the date of the ride.\n\n8. **Ask for Time**\n   - Inquire about the preferred time for the journey.\n\n9. **Confirm the Booking:**\n    - 1: Proceed to Step 10 for confirmation and thank you message.\n    - 2: Move to Step 11 to select additional options.\n\n10. **Thank You Message and \"Cancel\" Option**\n    - Express gratitude to the user and provide an option to cancel the booking.\n\n11. **Select Option:**\n    - 1: Go back to Step 2 and ask for day or night again.\n    - 2: Proceed to Step 3 and ask for the type of service.\n    - 3: Reset the state, stop the booking, and send a thank you message.\n    - 4: Restart the process, reset the state, and send the initial message from Step 1.\n\n\n## Booking Confirmation Process\n\nWhen a user books a cab, the system follows a confirmation process involving the owner. The booking goes through the following stages:\n\n1. **User Books Cab:**\n   - User completes the booking process.\n\n2. **Message Sent to Owner:**\n   - The system automatically sends a message to the owner informing them about the new booking.\n\n3. **Owner Confirmation:**\n   - Owner reviews the booking details.\n   - If the owner confirms the booking, the cab is marked as  booked.\n   - If the owner does not confirm, the booking remains in a pending phase.\n   - if the owner reject the booking, its marked as Cancelled\n\nThis confirmation process ensures that the cab is only fully booked when the owner confirms the user's booking request.\n\n\n\n### Cab Status\n\n1 - PENDING\n2 - CONFIRMED\n3 - CANCELLED \n4 - COMPLETED\n\n### Scan the QR Code: \nScan the displayed QR code with your WhatsApp mobile app.\n\n---\n\n\n### Technologies and Dependencies\n\nThis project utilizes the following technologies and dependencies:\n\n- `whatsapp-web.js`: Library for interacting with WhatsApp Web. [GitHub Repository](https://github.com/pedroslopez/whatsapp-web.js)\n- `qrcode`: Library for generating QR codes for authentication.\n- `axios`: Promise-based HTTP client for making requests.\n- `user_db`: ORM module for managing user data.\n- `user_ride_db`: ORM module for handling user ride information.\n- `owner_db`: ORM module for managing owner data.\n- `rate_card_db`: ORM module for rate card information.\n- `user_state`: Module for managing user state in the booking process.\n- `r_funcs`: Reusable functions for various functionalities.\n- `ed`: Encoder and decoder module for encoding and decoding messages.\n- `moment`: Library for parsing, validating, manipulating, and displaying dates.\n- `dotenv`: Module for loading environment variables from a `.env` file.\n- `mysql2`: Promise-based MySQL library for database interactions.\n- `node-cron`: Module for scheduling cron jobs in Node.js.\n- `format` (from `mysql2/promise`): Function for SQL query formatting.\n- `admin_state`: Module for managing the state of the admin.\n\n## Installation Guide\n\n### Prerequisites\n\n- Node.js installed on your machine.\n- MYSQL installed on your machine.\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/codeterrayt/WhatsAppCabBookingBot.git\ncd WhatsAppCabBookingBot\n```\n\n### Docker: MYSQL \u0026 PHPMYADMIN (OPTIONAL FOR DOCKER USERS ONLY)\n```bash\ndocker-compose up -d\n```\n\n\n### Install Dependencies\n```bash\nnpm install\n```\n\n### Run Project\n```bash\nnode index.js\n```\n\n### OR \n```bash\nnpm run start\n```\n\n### Setup Process (CLI)\n\n1. **Enter Owner Phone Number:**\n   - The CLI will prompt you to enter the owner's WhatsApp number.\n   - It must include the country code (e.g., `+91XXXXXXXXXX`).\n   - If you do not wish to add an owner, type `done` to skip.\n\n2. **Create Rate Cards:**\n   - The CLI will ask for rate card details such as:\n     - Booking Type\n     - Shift Type\n     - Return Journey (1 for Yes, 0 for No)\n     - Start Time\n     - End Time\n     - Extra Hour Price\n     - Notes\n   - You can add multiple rate cards.\n   - Type `done` to skip this step.\n\n### Scan the QR Code:\nScan the displayed QR code with your WhatsApp mobile app.\n\n---\n\n## Troubleshooting\nIf authentication fails, delete `.wwebjs_auth` and `.wwebjs_cache` directories, then restart the bot:\n```sh\nrm -rf .wwebjs_auth .wwebjs_cache \u0026\u0026 npm run start\n```\n\n---\n\n\n**WhatsApp Cab Booking Bot**\n\nFeel free to contribute to the project by submitting issues or pull requests.\n\nHappy cab booking! 🚗✨\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeterrayt%2Fwhatsappcabbookingbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeterrayt%2Fwhatsappcabbookingbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeterrayt%2Fwhatsappcabbookingbot/lists"}