Update Jekyll blog using Telegram

It's a simple Telegram bot to read messages and update a Jekyll blog.

  1. Read messages from a Telegram group, channel or direct chat.
  2. Parse the message and extract metadata and content.
  3. Create a new post in the Jekyll blog using Github's API.
  4. Deploy new changes using your CI/CD pipeline (It is up to you to implement this).

How to use it

  1. Create a new bot using BotFather and get the token.
  2. Create a new Github token with repo scope.
  3. Run the bot using the following environment variables:
    • TELEGRAM_TOKEN: The token of your bot
    • CHAT_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 format username/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

Message format

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.


Support 💛

Contributing 🤝

Don't be shy and reach out to us if you want to contribute 😉

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Issues

Each project may have many problems. Contributing to the better development of this project by reporting them. 👍

jekyll logo

Want a Jekyll website built?

Hire a Jekyll developer