A feedback collection and management system designed for the CS Internship Program. This bot automates the process of collecting, validating, and distributing feedback about teaching assistants and instructors.
CS Feedback Bot is a webhook-based application that:
- Receives feedback submissions from Tally forms
- Validates and encrypts sensitive data
- Stores feedback in a Notion database
- Sends automated Telegram notifications to both feedback senders and receivers
- Automated Webhook Processing: Handles form submissions via Tally webhook integration
- Secure Data Handling: Uses encryption/decryption for usernames and sensitive information
- Notion Database Integration: Stores all feedback in a structured Notion database
- Telegram Notifications: Sends personalized messages to stakeholders
- Error Handling & Logging: Admin notifications for system errors and failures
- Data Validation: Validates form completeness and data integrity
- Node.js - JavaScript runtime
- Express.js - Web server framework
- Notion API - Database storage
- Telegram Bot API - Notification delivery
- Tally - Form collection platform
Before running this project, ensure you have:
- Node.js (v14 or higher)
- npm (Node Package Manager)
- Git
- A Notion account with API access
- A Telegram Bot token
- A Tally account with form setup
- Clone the repository:
git clone https://github.com/cs-internship/CS-Feedback-Bot.git
cd CS-Feedback-Bot- Install dependencies:
cd project
npm install- Configure environment variables:
Create a
.envfile in theprojectdirectory with the following variables:
PORT=3000
NOTION_API_KEY_ANS=your_notion_api_key
NOTION_DATABASE_ID_ANS=your_notion_database_id
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_ADMIN_ID=your_telegram_admin_id
ENCRYPTION_KEY=your_encryption_key
- Start the server:
npm startThe server will run on the specified PORT and expose:
GET /- Health check endpointPOST /webhook/tally- Webhook endpoint for Tally form submissions
-
Configure Tally webhook:
- Set your Tally form webhook to point to:
YOUR_SERVER_URL/webhook/tally - You can use ngrok for local development:
ngrok http 3000
- Set your Tally form webhook to point to:
-
Submit feedback through Tally form and watch notifications appear on Telegram!
project/
├── server.js # Express server configuration
├── notionService.js # Notion database operations
├── utils/
│ ├── telegramService.js # Telegram bot integration
│ ├── decryptAndValidate.js # Encryption/decryption utilities
│ ├── parseFormFields.js # Form data parsing
│ ├── getTelegramIdByUsername.js # Username to Telegram ID mapping
│ ├── errorReporter.js # Error notification system
│ ├── questions.js # Survey questions configuration
│ └── telegramMessageTemplate/ # Message template builders
│ ├── buildSenderSuccessMessage.js
│ ├── buildSenderErrorMessage.js
│ ├── buildReceiverMessage.js
│ └── buildAdminLogMessage.js
└── package.json # Project dependencies
- Form Submission: User submits feedback via Tally form
- Webhook Reception: Server receives webhook payload from Tally
- Data Processing: Form fields are parsed and validated
- Encryption Check: Sensitive data is decrypted and validated
- Notion Storage: Feedback is stored in Notion database with structured properties
- Notifications: Telegram messages are sent to sender, receiver, and admin
- Error Handling: Any errors are logged and reported to admin
| Variable | Description |
|---|---|
PORT |
Server port number (default: 3000) |
NOTION_API_KEY_ANS |
Notion API authentication key |
NOTION_DATABASE_ID_ANS |
Notion database ID for feedback storage |
TELEGRAM_BOT_TOKEN |
Telegram bot token from BotFather |
TELEGRAM_ADMIN_ID |
Telegram user ID for admin notifications |
ENCRYPTION_KEY |
Secret key for data encryption/decryption |
This project is licensed under the MIT License.
- Author: Ali Sadeghi
- Developed for: CS Internship Program