Telegram bot that automatically adds links to the content/links/_index.md file of a Hugo site hosted on GitHub Pages.
- You send a message with a URL to the bot on Telegram
- The bot fetches the page title automatically
- A formatted entry is prepended to
content/links/_index.mdvia the GitHub API - The GitHub Actions workflow triggers and deploys the updated site within ~2 minutes
The bot parses three components from your message: URL, tags, and comment.
https://example.com #tag1 #tag2 Optional comment here
| Component | Required | Format | Example |
|---|---|---|---|
| URL | ✅ Yes | Must start with http:// or https:// |
https://martinfowler.com/articles/data-mesh.html |
| Tags | ❌ No | Words prefixed with # |
#datamesh #architecture |
| Comment | ❌ No | Any text that is not a URL or tag | Interesting take on data ownership |
URL only:
https://martinfowler.com/articles/data-mesh.html
URL with tags:
https://martinfowler.com/articles/data-mesh.html #datamesh #architecture
URL with tags and comment:
https://martinfowler.com/articles/data-mesh.html #datamesh #architecture Interesting take on data ownership
Order does not matter — tags and comment can appear before or after the URL:
#ai #governance https://example.com Great overview of AI governance frameworks
Each message produces an entry like this:
- [Page Title](https://example.com) — Great overview of AI governance frameworks
`#ai` `#governance`
`2026-05-07`If the page title cannot be fetched (e.g. the site blocks scraping), the domain name is used as fallback:
- [example.com](https://example.com)
`2026-05-07`| Variable | Description |
|---|---|
TELEGRAM_TOKEN |
Token from @BotFather |
GITHUB_TOKEN |
GitHub Fine-grained Personal Access Token (Contents: read/write) |
GITHUB_REPO |
Repository in owner/repo format (default: thrama/thrama.github.io) |
ALLOWED_USER_ID |
Your Telegram numeric user ID (see below) |
- Create a new private GitHub repo (e.g.
hugo-links-bot) and push these 3 files:bot.py,requirements.txt,Procfile - Go to railway.app → login with GitHub
- New Project → Deploy from GitHub repo → select
hugo-links-bot - Go to the service → tab Variables → add the 4 environment variables above
- Railway deploys automatically after saving the variables
Open Telegram, search @RawDataBot, send any message.
It replies with a JSON — your ID is the value of message.from.id.
- Open Telegram → search @BotFather
- Send
/newbot - Follow the prompts to choose a name and username
- BotFather replies with your token — copy the full string including the numeric prefix (e.g.
7123456789:AAF...)
Verify the token is valid:
https://api.telegram.org/botYOUR_TOKEN/getMe
Should return "ok": true.
| File | Description |
|---|---|
bot.py |
Main bot script |
requirements.txt |
Python dependencies |
Procfile |
Railway worker definition |