Skip to content

Telegram bot for Redmine notifications, developed exclusively for personal use. If you find it useful and necessary, please let me know! telegram: @danek_kulikov

Notifications You must be signed in to change notification settings

zonder12120/go-redmine-tg-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redmine Telegram Notification Bot

Project Overview

Redmine Telegram Notification is a Telegram bot designed to notify users about updates and status changes of issues in Redmine. Developed for personal use, this project can be utilized by others, and feedback is greatly appreciated.
For any inquiries or suggestions, reach out via Telegram: @danek_kulikov

Table of Contents

Configuration

Create a .env file in the root directory of the project with the following environment variables:

  • REDMINE_BASE_URL: Base URL for your Redmine instance like https://redmine.your-company.com
  • REDMINE_API_KEY: Your API key for Redmine.
  • TELEGRAM_TOKEN: The token for your Telegram bot.
  • CHAT_ID: The chat ID where the bot will send notifications.
  • PROJECTS_LIST: Here is a list of project IDs for which you want to receive notifications. You can get the list of project IDs and their names using the GetProjectsList() method in the redmine package. This method is called by default in main and logs the list of projects to the console.
  • TIME_ZONE: Here you need to specify the name of the time zone, you can get the name on this site: nodatime.org

ATTENTION, CUSTOM RUSSIAN HOLIDAY CALENDAR IN USE!
If you are not from Russia, you can find an API for your country's calendar. I don't think there would be any difficulties with that.

Example .env file:

TELEGRAM_TOKEN="your_telegram_bot_token"
CHAT_ID="your_chat_id"
REDMINE_API_KEY="your_redmine_api_key"
REDMINE_BASE_URL="https://redmine.your-company.com"
PROJECTS_LIST="1,2,3"
TIME_ZONE="Europe/Moscow"

Start app

Clone repository on ur server.

Edit Dockerfile, on the go build line, because the OS and architecture may differ from mine.

Create .env in ./cmd, as in the example described above, then run next commands from the root of the directory:

make build
make run

Makefile

  • build: Build image.
  • run: Run image.
  • stop: Stop the container.
  • restart: Stop, then run the container.
  • logs: Show container logs.
  • clean: Delete image.

Functionality

The bot retrieves a list of tasks through the Redmine API, maps the tasks, and adds comments to each task.
After a specified time interval, it fetches a new list of tasks with the same request, maps the new list of tasks, and adds comments to each new task.
Then, the old map and the new map are compared by iterating through each task in a for loop.
If a new task appears in the new map that was not in the old map, a notification about the new task is immediately created.
If the task is not new but a change of interest is found, this change is added to the message about task updates.
Once all relevant changes for the task are added, a template notification message is generated and sent to the specified Telegram chat.

Notifications

Generates a notification message that will be sent to a Telegram chat:

  • New Issues: Notifies about newly added issues.
  • Status change: Аdds a message indicating that the task status has changed.
  • Priority change: Аdds a message indicating that the task priority has changed.
  • Assignee change: Аdds a message indicating that the task assignee has changed.
  • New comment: Аdds a message indicating that a comment has been added, including the comment text.
  • Task emoji tagging: tags tasks based on status and tracker.

Time Management

  • Work Time Check: Check if the time is within work hours, including holidays.
  • Off hours changes: Collects the numbers of tasks that had changes during off-hours.

Feel free to contribute, fork, or suggest improvements. Your feedback is valuable in making this bot more efficient and user-friendly. For further assistance or to report issues, please contact via Telegram: @danek_kulikov

For a full explanation of the code and more detailed instructions, please refer to each file's comments and functions within the codebase.

About

Telegram bot for Redmine notifications, developed exclusively for personal use. If you find it useful and necessary, please let me know! telegram: @danek_kulikov

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published