Skip to content

Om-Midya/booking_bot

Repository files navigation

Bot9 Palace Booking Bot

Overview

The Bot9 Palace Booking Bot is a Telegram bot designed to assist users in booking rooms at the Bot9 Palace. Users can interact with the bot to view available rooms and book them by providing necessary details. Upon successful booking, the bot generates a booking ID and confirms the room reservation.

Features

  • View Available Rooms: Users can inquire about available rooms and their prices.
  • Book Rooms: Users can book rooms by providing their full name, email, number of nights for the stay, and the room name.
  • Booking Confirmation: The bot generates a booking ID and confirms the reservation with the user.

Setup Instructions

Prerequisites

  • Node.js installed on your system.
  • A Telegram account.
  • MySQL installed on your system.

Step 1: Clone the Repository

Clone the project repository to your local machine using the following command:

git clone <repository-url>

Step 2: Install Dependencies

Navigate to the project directory and install the required dependencies using the following command:

npm install

Step 3: Create a Telegram Bot

NOTE: If do not want to use a telegram bot scroll down to step 8 "Using Postman to interact with the bot"

  • Open the Telegram app and search for the BotFather.
  • Create a new bot by following the instructions provided by the BotFather.
  • Copy the bot token generated by the BotFather.
  • Set the bot privacy to Disable to allow the bot to read all messages sent to it.
  • Copy the bot token and save it for later use.

Step 4: Obtain OpenAI API Key

  • Visit the OpenAI website and sign up or log in.
  • Navigate to the API section and generate a new API key.

Step 5: Configure Environment Variables

Create a .env file in the project directory and add the following environment variables:

TELEGRAM_BOT_TOKEN=<your_telegram_bot_token>
OPENAI_API_KEY=<your_openai_api_key>

Step 6: Set Up the Database

  • Create a new MySQL database.
  • In the config.json file replace the database name, username, and password with your database details.

Step 7: Start the Bot and the Server

Run the following command to start the bot:

node bot.js

Run the following command to start the server:

node server.js

Step 8: Using Postman to interact with the bot

  • Open Postman after starting the server.
  • Send a POST request to http://localhost:3000/chat/ with the following JSON body:
{
  "chatId": "<This is basically the user id that is provided by the telegram bot api, use unique numbers for your users>", 
    "message": "<Your message>"
}
  • The bot will respond with a message body that contains the bot response.

Usage

After starting the bot, you can interact with it through Telegram by sending messages. Use the /start command to begin a conversation with the bot and follow the prompts to view available rooms or book a room.

Video Demo

bot_booking.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published