First Steps¶
Your first steps with tg-note after installation.
1. Get Your Telegram Bot Token¶
Create a Bot with BotFather¶
- Open Telegram and search for @BotFather
- Start a chat and send
/newbot
- Follow the prompts:
- Choose a name for your bot (e.g., "My Knowledge Bot")
- Choose a username (must end in "bot", e.g., "my_knowledge_bot")
- BotFather will give you a token - save it securely!
Example token format:
Add Token to Configuration¶
Add your token to .env
:
2. Get Your User ID (Optional)¶
If you want to restrict bot access to only yourself:
- Open Telegram and search for @userinfobot
- Start a chat and send any message
- Bot will reply with your user info
- Copy your User ID
Add to config.yaml
:
3. Setup Knowledge Base¶
Option A: Local Knowledge Base¶
Create a new local Git repository:
mkdir my-knowledge-base
cd my-knowledge-base
git init
git add .
git commit -m "Initial commit"
cd ..
Update config.yaml
:
Option B: GitHub Knowledge Base¶
- Create a new repository on GitHub (e.g.,
my-kb
) - Clone it locally:
- Update
config.yaml
:
KB_PATH: ./my-kb
KB_GIT_ENABLED: true
KB_GIT_AUTO_PUSH: true
KB_GIT_REMOTE: origin
KB_GIT_BRANCH: main
4. Start the Bot¶
Expected output:
INFO - Starting tg-note bot...
INFO - Configuration validated successfully
INFO - Processing tracker initialized
INFO - Repository manager initialized
INFO - Telegram bot started successfully
INFO - Bot initialization completed
INFO - Press Ctrl+C to stop
5. Initialize Bot in Telegram¶
Open Telegram, find your bot, and send:
Bot should reply with a welcome message!
6. Configure Knowledge Base in Telegram¶
Tell the bot where to save notes:
Or use a GitHub repo:
7. Send Your First Message¶
Send or forward any message to the bot. Examples:
- Plain text message
- Forwarded message from a channel
- Article link
- Multiple messages
The bot will process and save it to your knowledge base!
8. Check Your Knowledge Base¶
Look in your KB directory:
You should see:
9. Verify Git Commits¶
You should see automatic commits!
10. Explore Bot Commands¶
Try these commands:
/help # Show all commands
/kb # Show KB info
/status # Show statistics
/settings # Open settings menu
Next Steps¶
-
Learn All Commands
Master all bot commands and features
-
Upgrade Your Agent
Install Qwen Code CLI for better AI processing
-
Customize Settings
Configure bot behavior via Telegram
-
Organize Your KB
Learn KB structure and organization
Common First-Time Issues¶
Bot Not Responding¶
- Check if bot is running in terminal
- Verify bot token in
.env
- Check logs:
tail -f logs/bot.log
"Not authorized" Error¶
- Wrong bot token
- Check
.env
file - Restart the bot
KB Not Created¶
- Check
KB_PATH
in config - Ensure directory exists
- Check permissions
Messages Not Saved¶
- Check logs for errors
- Verify KB setup:
/kb
- Check Git status in KB folder