It's a simple Telegram bot to read messages and update a Jekyll blog.
- Read messages from a Telegram group, channel or direct chat.
- Parse the message and extract metadata and content.
- Create a new post in the Jekyll blog using Github's API.
- Deploy new changes using your CI/CD pipeline (It is up to you to implement this).
- Create a new bot using BotFather and get the token.
- Create a new Github token with
repo
scope. - Run the bot using the following environment variables:
TELEGRAM_TOKEN
: The token of your botCHAT_ID
: A chat id that the bot should listen to. It can be a group, channel or a direct chat.DEBUG_CHAT_ID
: A chat id to send debug messages (For example, you can get all errors in your private chat)GITHUB_TOKEN
: The token to access the Github API.GITHUB_REPO_NAME
: The name of the repository with the formatusername/repo
.POST_PATH
: The target path to create the new post. For Jekyll blogs, it is_posts
.
Tip
You can use TELEGRAM_BASE_URL
environment variable to change the base URL of the Telegram API.
docker run -d --name jekyll-telegram-bot \
-e TELEGRAM_TOKEN=your-telegram-token \
-e CHAT_ID=your-chat-id \
-e DEBUG_CHAT_ID=your-chat-id \
-e GITHUB_TOKEN=your-github-token \
-e GITHUB_REPO_NAME=your-username/your-repo \
-e POST_PATH=_posts \
hatamiarash7/tg-blog-updater:v1.0.1
There is a default format to create a new post. The bot will parse the message and create a new post using the following format:
title
===
tags ( comma separated )
===
content
For example:
Hello world
===
jekyll,telegram,blog
===
This is the content of the post
Note
You should change the code if you want to use a different format.
Don't be shy and reach out to us if you want to contribute 😉
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Each project may have many problems. Contributing to the better development of this project by reporting them. 👍