NotifierBot icon indicating copy to clipboard operation
NotifierBot copied to clipboard

Telegram/Slack notification system that creates small but important reports for employees

trafficstars

Telegram/Slack Notifier Bot

CI Deploy to Heroku Codacy Badge Hits Known Vulnerabilities


Heroku-hosted application mostly used to create various Reports for Slack. Telegram bot that duplicates the reports and has admin panel that is used to handle situations where reports are incorrect.

Designed for internal use inside company.


PLEASE NOTE THAT THIS PROJECT WON'T COMPILE (as I am too lazy to create a self-sufficient working demo profile)

Due to security restrictions this repository doesn't contain tokens.

If you would like to run this code:

  • 'dev' profile by default does not include any Slack reporters - they can be enabled by adding 'slack-dev' profile to active profiles
  • Telegram bot can be enabled by adding telegram.bot.token property value in telegram-dev config
  • Bot admin token 'telegram.bot.admin' is required to send start-up report and unauthorized request messages

Feature toggles can be discovered by looking out for @ConditionalOnProperty annotation


Technologies used:

Java 14, Spring (Boot, Data JPA), Hibernate, Postgres, H2, Flyway and a bunch of APIs (Slack, Telegram, Google Sheets).


Features:

  • Separate profiles (dev, prod)
  • CI/CD in Travis with automatic deployment of the latest version of master branch to Heroku

Telegram bot:

  • Authentication is based on green list of tokens stored in Postgres DB
  • Role-based authorization
  • Bot admin is notified if user calls a command he is unauthorized to use
  • Help message is generated dynamically (based on user roles)
  • Unauthorized users can get their token
  • Different reports for authorized users - upcoming birthdays, customer debts, recent payments
  • Scheduling of individual notification time for each user
  • Admin panel that enables data loading audition, data reloading and manual slack payload execution directly from the bot

Screenshots:

Message about successful initialization:

ScreenShot

Unauthorized user available commands:

ScreenShot

Authorized user (employee) available commands:

ScreenShot

Authorized user (manager, head) available commands:

ScreenShot

Schedule management:

ScreenShot


Deployment

Deployment via Heroku CLI:

mvn clean heroku:deploy

Starting up:

heroku ps:scale worker=1 -a app_name

Retrieving logs:

heroku logs -a app_name