Telegram bot on guard in Redmine

A true story with a happy ending, about how a bot for Telegram increased revenue and streamlined the work of the development team.

background

It all started with the fact that in the working Telegram chat, where we exchange working, not quite working and frankly not working messages, we decided to share quality assessments of buns and pies from a nearby bakery. The rolls there are presented in a large assortment and the eyes around the counter run wide.

We agreed that everyone who tastes the pie will unsubscribe in the chat and rate from 1 to 5. Over time, the history of tastings should accumulate and we will be able to calculate the average rating for each bun.

We eat pies, put marks, time goes by. But besides the rating of bakery products, work slips in the working chat, which clogs the feed. As a result, the assessments of rolls were mixed with discussions of tasks. Mission failed, no statistics. But programmers can always find a solution. Here we remembered about Telegram bots. You can organize an electronic assistant for yourself. No sooner said than done. A couple of hours and the first version of the bot is ready, which accepts ratings in the general chat and shares precious statistics on request.

Screenshot of communication with the bot:

What else can a bot do?

After the launch of the bot, they began to throw in ideas of what else to teach our electronic assistant. And away we go. During the working day, in short breaks between tasks, we added a few little things:

  • notification that it’s time to go for a smoke break;

  • notification that it’s time for lunch;

  • notification that it’s time to drink coffee (in the morning) or tea (five-o-clock).

After playing with the bot, we thought about really useful features that can simplify the workflow. We remembered that there are problems with renewing SSL certificates and domains for client sites. Not every hosting supports cron or auto-renewal, you have to do it regularly in “manual mode”. Renewing a domain or certificate is not difficult, the main thing is to remember it in time.

For the bot, this task turned out to be simple:

  • steal the site headers and determine the expiration date of the SSL certificate. If there are less than 7 days left until X-hour, send a notification;

  • make a request to the whois service, pull out the domain payment term and also check with the current date. If the domain dies in a week, then it’s time to send a notification.

The implementation took another couple of hours, but the benefits of such a feature are already palpable. My heart became calmer.

What else?

Obviously, the potential of the bot is huge, it remains to figure out which function to screw next. We thought about it and came to the conclusion that we have a problem with reports and uploads of the task manager / work time tracker. We use a file-modified Redmine. Over the past 3 years, we tried twice to implement an add-on for generating reports on tasks, but each time they abandoned it, dug too deep, and it was inconvenient to use uploads. In addition, not all developers keep track of their active timers in tasks. During the working month, we lost up to 15-20% of hours, which for various reasons were not noted. It happens that an urgent task arrives and you immediately plunge into it, forgetting to turn on the timer. And simple inattention also happens, you remember about the timer not immediately. Because of this, it was necessary to collect monthly reports in a semi-manual mode, remembering if hours were lost in the task. But it is not always possible to restore the chronology, and the month closes with losses. At the same time, all employees are 100% loaded, there are always active tasks for several weeks ahead, but it is impossible to reliably close all 160 hours.

It will not work to constantly monitor the timers either, this is a separate “supervisor” is needed, which will only be to keep an eye on labor costs.

Wait a minute… But we have a bot that can monitor this and report violations. And since they launched it into the task manager, let them also look after the implementation of the regulations: what statuses change for tasks, what deadlines are approaching, how task priorities have changed, etc.

We quickly collect a list of problem areas, explain to the bot, and now we have a new version of the assistant. Time to come up with a name for him. They dubbed the bot “Iron Felix”, in honor of one famous uncle who was well able to look after the implementation of the regulations.

In just 23 working hours, we taught Iron Felix:

  1. Check the activity of programmer timers. If the timer is not enabled, then notify the responsible manager and programmer about this;

  2. Check tasks and notify employees if there have been changes in task priorities;

  3. Check tasks and notify programmers if a second task suddenly appears with the status “In Progress”. This status means that the task is currently in operation, there should not be two active ones at the same time;

  4. Remind programmers and managers of the need to add a comment to the task if it recorded activity during the day (labor costs were noted) and no text comments were received. The notification is sent at the end of the working day and is duplicated in the morning of the next day if the comment has not yet been added;

  5. At the end of the working day for each programmer, the number of noted labor costs is checked and notifies the manager if less than 7 hours were noted;

  6. Half an hour after the end of the working day, check the active timers. If there are any, send a reminder notification to stop the timer and adjust the actual time. Condolences come as a bonus if the employee is still working;

  7. Send a notification about the need to start executing a task if a reminder has been set for it in advance;

  8. Notify the responsible person about the status change in tasks;

  9. Notify the responsible person if he passed the task with the wrong status or did not pass it on;

  10. In the morning, remind the manager about open tasks that have not been active for a long time;

  11. At the end of the working day, send a report to the manager on the labor costs of all programmers per day, broken down by tasks;

  12. At the end of the working day on Fridays, send a report of the labor costs of programmers for the week, broken down by projects;

  13. Notify the manager if the actual labor costs are approaching the planned ones or the deadline is approaching;

  14. An hour before the end of the working day, remind everyone that there is a “Knowledge Base” and something needs to be added there if there were interesting / non-standard situations during the day;

  15. Upon request, the bot creates subdomains and deploys test sites. Convenient for layout designers – no need to ask a developer or system administrator.

  16. Upon request, the bot can find information in the knowledge base (a WordPress blog with working notes and regulations) and provide a link to the full description

To count the activity of the timers, I had to go directly into the Redmine database, since we have a non-standard time tracker, but it is configured through a plugin. I also had to improvise in order to quickly respond to changing the status of tasks and rearranging them on the scrum board. Api Redmine does not provide such callbacks, and for scrum we generally have a separate module. Therefore, we added callbacks ourselves, slightly modernizing the Redmine code. For all other items, the standard api of the task manager was used.

Stars from GTA for misdemeanors

To make it easier to debug all the functions of the bot, they began to collect event logs that Iron Felix processes. When everything worked and all the bugs were fixed, they decided to leave the logging and even put it into action. Stars were awarded for each mistake, just like in GTA. More offenses – more stars. All “jambs” are reset at the end of the working day, but before leaving home, a message with statistics arrives in the general chat.

At first it was for the sake of a joke, but suddenly excitement appeared and the number of errors began to decrease. Nobody wanted to get a star. In the first couple of days of the bot’s work, we collected 3-4 stars each, and a week later – 1-3 stars per test group.

Report generation

The bot quickly taught employees how to use the task manager according to the regulations, and after a week unaccounted working hours were reduced to a minimum. And having the correct actual hours, you can automate the generation of reports.

We did not create a separate interface for this, we implemented requests through a bot – everything is in one place. It is both more convenient to use and faster to develop, no front-end is needed. In one working day, Iron Felix was trained to generate reports in Excel: uploading for any period of time for any project. The report includes a complete list of tasks and labor costs, taking into account all the parameters that we use in the formation of estimates.

Happy end

In the first month, in the test group supervised by the bot, the total number of marked hours in tasks increased and losses decreased by 12.5%. It’s just the hours we’ve always lost. Plus, now managerial time is saved, which was spent on reporting. As a result, we not only covered the labor costs for the development of the bot, but also increased the revenue, since we work with most of the customers on a pay-as-you-go basis and every hour = money.

And most importantly, the team has learned to work according to the rules, now the statuses of tasks are not confused, priorities are always clear, and programmers do not have to keep in mind all the iterations that a task should have. If something does not go according to plan, the bot will always prompt and remind you.

Afterword

There are no technical points in the article, I tried to talk only about the logic of the bot and share the joy that sometimes simple solutions lead to tangible profit. And interesting ideas can come from completely bad and unrelated ideas.

If someone is interested in technical nuances, then ask in the comments, I will try to answer everyone. There were no innovations in the implementation of the bot, everything has already been said and not once, but if there are a lot of requests, then I will prepare an article with a description for techies.

With best wishes Evgeniy Ipatov, head of development department in OWL agency.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *