Telegram bot that listens to your internal Telegram group, extracts structured feedback from forwarded moderator posts, and writes it to Google Sheets with a CSV daily fallback.
- Reads new messages from your internal Telegram group.
- Extracts:
- A:
Wish/suggestion - ABSTRACT - B:
Category(dropdown-ready) - C:
Product/direction(dropdown-ready) - D:
Comment/ Text of the appeal(full text) - E:
Source(FB,Telegram,X,Discord,Insta,Reddit) - F:
Created by(Moderatorsby default) - G:
Date
- A:
- Detects original username via forwarded metadata when available.
- If no forwarded metadata exists, tries to parse username from text (for example
From vadrasla: ...or@DecentralizeADA (X)). - Uses an OpenAI-compatible endpoint for extraction and categorization.
- Deduplicates processed Telegram messages via SQLite.
- Writes to Google Sheets (if configured) and also exports daily CSV (configurable).
- A bot receives only updates after it is added to the group. It cannot backfill old history by default.
- Disable bot privacy mode in BotFather (
/setprivacy->Disable) so it can read non-command messages in groups. - Add the bot to the internal group and make sure it has permission to read messages.
- Use
/whereamiin a chat with the bot to getchat_idforTELEGRAM_ALLOWED_CHAT_IDS.
- Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Create
.envfrom.env.example:
cp .env.example .env- Fill required values in
.env:
TELEGRAM_BOT_TOKENOPENAI_BASE_URL,OPENAI_API_KEY,OPENAI_MODEL- Optional Google Sheets integration:
GOOGLE_SHEETS_IDGOOGLE_SERVICE_ACCOUNT_FILEGOOGLE_WORKSHEET_NAME
- If using Google Sheets:
- Create a Google Cloud service account and download JSON key.
- Share the target Google Sheet with service account email (Editor role).
- Put the JSON key at
./credentials/service-account.json(default in.env.example).
- Run the bot:
set -a; source .env; set +a
python -m tangem_feedback_bot.main- Prepare env:
cp .env.example .env-
Fill
.envwith yourTELEGRAM_BOT_TOKENand OpenAI values. -
Optional Google Sheets:
- Save service account key to
./credentials/service-account.json. - Keep
GOOGLE_SERVICE_ACCOUNT_FILE=./credentials/service-account.jsonin.env.
- Start:
docker compose up -d --build- Check logs:
docker compose logs -f tangem-feedback-bot- Stop:
docker compose downTELEGRAM_BOT_TOKEN(required)TELEGRAM_ALLOWED_CHAT_IDS(optional, comma-separated chat IDs; if empty, accepts all chats)OPENAI_BASE_URL(defaulthttps://api.openai.com/v1)OPENAI_API_KEY(optional but recommended)OPENAI_MODEL(defaultgpt-4o-mini)GOOGLE_SHEETS_ID(optional)GOOGLE_WORKSHEET_NAME(defaultFeedback)GOOGLE_SERVICE_ACCOUNT_FILE(optional)FALLBACK_EXPORT_DIR(default./exports)ALWAYS_EXPORT_DAILY_CSV(defaulttrue)INCLUDE_ORIGIN_IN_COMMENT(defaulttrue)SQLITE_PATH(default./data/state.db)CREATED_BY_VALUE(defaultModerators)DATE_FORMAT(default%d/%m/%Y)TIMEZONE(defaultEurope/Warsaw)LOG_LEVEL(defaultINFO)
Networks / Providers AddingTokens/Coins/Memes AddingNFT AddingNew FeaturesStatistics / ChartsFlow ChangingUX/UIOther
Wallet appStakingSwapPayConnectOn-ramp / Off-rampEarnRingsCardsOrders & DeliveryOther
- Google Sheets append (A-G columns), with data validation dropdowns for
Category,Product/direction, andSource. - Daily CSV file in
exports/feedback-YYYY-MM-DD.csv. - Internal SQLite DB for dedup + audit records in
data/state.db.