This project is a sophisticated system designed to collect, analyze, and manage anonymous employee feedback via a Telegram bot. It was developed as a solution for the Java Junior Developer test task.
The system consists of two main components:
- A Telegram Bot that serves as the primary interface for employees to register and submit feedback.
- A Spring Boot Web Application that provides a powerful admin panel to view, filter, and analyze all submitted feedback.
The application leverages the OpenAI API for intelligent text analysis, automatically determining feedback sentiment, criticality, and a suggested solution. It also integrates with Google Docs and Trello for seamless reporting and task management.
-
🤖 Telegram Bot Interaction:
- Seamless Registration: On first use, the bot guides the user through a simple registration process to select their position (e.g., Mechanic, Electrician) and branch.
- Effortless Feedback Submission: Registered users can send any text message to the bot, which is treated as a piece of feedback.
-
🧠 AI-Powered Analysis (via OpenAI):
- Sentiment Analysis: Automatically classifies feedback as
POSITIVE,NEUTRAL, orNEGATIVE. - Criticality Assessment: Assigns a criticality score from 1 (minor) to 5 (urgent).
- Solution Suggestion: Generates a recommended course of action to address the feedback.
- Sentiment Analysis: Automatically classifies feedback as
-
💾 Database Persistence:
- All user information and feedback records are securely stored in a PostgreSQL database.
-
🔄 Automated Integrations:
- Google Docs Logging: Every piece of feedback is automatically appended to a central Google Document for easy, non-technical access and historical record-keeping.
- Trello Task Creation: For feedback marked as critical (level 4 or 5), a new card is automatically created on a specified Trello board for immediate action by management.
-
💻 Web Admin Panel:
- A comprehensive web interface built with Spring Boot & Thymeleaf, accessible at
http://localhost:8080/feedbacks. - Advanced Filtering: Allows administrators to search and filter feedback by branch, position, sentiment, criticality level, and date range.
- Paginated Results: Efficiently handles large volumes of feedback.
- Detailed View: A modal window provides a full, detailed view of each feedback item, including the original message and all analysis results.
- A comprehensive web interface built with Spring Boot & Thymeleaf, accessible at
The application follows a modern, service-oriented architecture designed for scalability and maintainability.
- Backend: Java 21, Spring Boot 3.5.5
- Database: PostgreSQL
- Data Access: Spring Data JPA / Hibernate
- Frontend (Admin Panel): Thymeleaf, Bootstrap 5
- Bot Framework: TelegramBots API
- AI Analysis: OpenAI API
- Integrations: Google Docs API, Trello API
- Utilities: Lombok, Jackson
Follow these steps to set up and run the project locally.
- Java JDK 21 or later.
- Apache Maven.
- PostgreSQL database server.
- An IDE such as IntelliJ IDEA.
You will need to obtain credentials for all external services:
- Telegram Bot:
- Talk to
@BotFatheron Telegram. - Create a new bot to get your Bot Token and Username.
- Talk to
- OpenAI:
- Sign up on the OpenAI Platform.
- Go to the API keys section and create a new API Key.
- Trello:
- Get your API Key at trello.com/app-key.
- Manually generate a Token from the same page.
- Create a board and a list for critical feedback. Find the List ID by opening a card on that list and adding
.jsonto the URL.
- Google Docs:
- Create a project in the Google Cloud Console.
- Enable the Google Docs API.
- Create a Service Account and download its credentials JSON file (e.g.,
credentials.json). - Create a new Google Doc and get its Document ID from the URL.
- Share the Google Doc with the service account's email address, giving it "Editor" permissions.
- Place your downloaded Google Service Account
credentials.jsonfile inside thesrc/main/resourcesdirectory. - In the
src/main/resourcesdirectory, create a file namedapplication.properties. - Fill in the file with your credentials obtained in the previous step, using the template below.
# ========================================
# APPLICATION CONFIGURATION
# ========================================
# === DATABASE CONFIGURATION ===
spring.datasource.url=jdbc:postgresql://localhost:5432/feedback_db
spring.datasource.username=postgres
spring.datasource.password=your_db_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
# === TELEGRAM BOT CONFIGURATION ===
telegram.bot.token=YOUR_TELEGRAM_BOT_TOKEN
telegram.bot.username=YOUR_TELEGRAM_BOT_USERNAME
# === OPENAI CONFIGURATION ===
openai.api.key=YOUR_OPENAI_API_KEY
# === TRELLO INTEGRATION ===
trello.api.key=YOUR_TRELLO_API_KEY
trello.api.token=YOUR_TRELLO_TOKEN
trello.api.list-id=YOUR_TRELLO_LIST_ID
# === GOOGLE DOCS INTEGRATION ===
google.docs.document-id=YOUR_GOOGLE_DOC_ID
google.docs.credentials-path=credentials.jsonCreate a new database in PostgreSQL. For example, using the psql command-line tool:
CREATE DATABASE feedback;Spring Boot with Hibernate (ddl-auto: update) will automatically create the necessary tables on the first run.
You can run the application in several ways:
A) From your IDE (Recommended):
- Open the project in IntelliJ IDEA.
- Wait for Maven to download all dependencies.
- Find the main application class (the one with the
@SpringBootApplicationannotation). - Right-click and select "Run".
B) Using Maven from the command line: Navigate to the project's root directory and run:
mvn spring-boot:runThe application will start, and the Telegram bot will begin polling for updates.
- Find your bot on Telegram using its username.
- Send the
/startcommand. - The bot will prompt you to select your position from a custom keyboard.
- Next, it will ask for your branch name.
- Once registered, any text message you send will be processed as feedback. You will receive a confirmation after your feedback is analyzed.
- Open your web browser and navigate to
http://localhost:8080/feedbacks. - You will see a paginated list of all feedback received.
- Use the filter form at the top to narrow down results by branch, position, sentiment, criticality, or date.
- Click the "Деталі" button on any row to open a modal with the full, detailed information about that feedback, including the original message and AI-generated solution.