Screencast.from.07-07-24.03_47_55.PM.IST.3.webm
Develop a RESTful API using Express.js that implements a chatbot capable of handling hotel booking queries. The chatbot will use OpenAI's API for natural language processing and maintain conversation history.
- POST /chat - Handle user messages and return chatbot responses.
- User initiates a conversation about booking a resort room.
- Bot fetches room options from an API and responds with a list of room options.
- User selects a room.
- Bot provides pricing information.
- User confirms they want to proceed with booking.
- Bot makes a simulated API call to book the room and returns a booking confirmation with a booking ID.
- Node.js (v14 or higher)
- npm (v6 or higher)
- SQLite3
-
Clone the repository
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
-
Run the server:
npm start
-
Open a web browser and navigate to http://localhost:3001 to interact with the chatbot.
room-book-ai/
├── public/
│ ├── index.html
│ ├── style.css
├── server.js
├── db.js
├── package.json
├── .env
├── README.md