This repository contains a RESTful API built using Express.js, SQLite, and Sequelize ORM. The API serves as the backend for a platform where users can create chatbots that have conversations with end users.
-
Clone the repository:
git clone https://github.com/prithidevghosh/simpleBot.git cd simpleBot -
Install dependencies:
npm install
-
Start the server:
nodemon
The API will be available at
http://localhost:3000.
- POST /users: Create a new user
- GET /users: List all users
- GET /users/:id: Retrieve a single user
- PUT /users/:id: Update a user
- DELETE /users/:id: Delete a user
- POST /users/:userId/chatbots: Create a new chatbot for a user
- GET /users/:userId/chatbots: List all chatbots for a user
- GET /chatbots/:chatbotId: Retrieve a single chatbot
- PUT /chatbots/:chatbotId: Update a chatbot
- DELETE /chatbots/:chatbotId: Delete a chatbot
- POST /chatbots/:chatbotId/conversations: Start a new conversation for a chatbot
- GET /chatbots/:chatbotId/conversations: List all conversations for a chatbot
- GET /conversations/:conversationId: Retrieve a single conversation
- PUT /conversations/:conversationId: Update a conversation (e.g., mark as completed)
- DELETE /conversations/:conversationId: End/delete a conversation
- POST /endusers: Register a new end user
- GET /endusers: List all end users
- GET /endusers/:endUserId: Retrieve details of a single end user
- PUT /endusers/:endUserId: Update end user details
- DELETE /endusers/:endUserId: Delete an end user
The API endpoints that return multiple items (such as users, chatbots, conversations, and end users) include pagination for a better user experience. Use the limit and offset query parameters to navigate through the paginated results.
- Use tools like Postman or cURL to make requests to the API endpoints.
- Replace
:userId,:chatbotId,:conversationId, and:endUserIdwith actual IDs in the URL.