Jira-telegram-bot is a Spring Boot application which handing Jira webhook events and sends notifications via Telegram bot.
You can build application using following command:
./gradlew clean build
JDK >= 1.8
You can run unit tests using following command:
./grdlew test
You can run mutation tests using following command:
./grdlew pitest
You will be able to find pitest report in build/reports/pitest/
folder.
You can run integration tests using following command:
./grdlew testIntegration
After the build you will get fully executable jar archive
You can run application using following commands:
java -jar jira-telegram-bot.jar
or
./jira-telegram-bot.jar
For building the application and creation Docker image run
docker-compose build
Customise configs with you preferred editor
place configs in ./config directory
Add to docker-compose.yaml your preferred database service
Run the docker image
docker-compose up -d
You can see all the necessary configuration properties in the file example/application.properties
According to Spring Docs you can override default application properties by put custom application.properties file in one of the following locations:
/config
subdirectory of the current directoryTo receive jira webhooks you may to configure your jira instance. See jira docs
WARNING!
Jira-telegram-bot supports only issue events at the moment
By default jira-telegram-bot process only following issue events:
If you want to process any other issue event or change default template you can modify corresponding row in jira-telegram-bot database table called templates.
Jira-telegram-bot using Apache FreeMarker template engine. All templates by default stored in jira-telegram-bot database table called templates. Each template must be a message in properly telegram markdown style.
In example/templates folder you can find default jira event templates.
To register jira user to receive webhook events you should add corresponding row into jira-telegram-bot database table called chats.
You should specify jira_id (jira user login) and telegram_id (telegram chat id) unique fields.
To find out your telegram chat id you should write simple command "/me" to telegram bot.
Telegram bot supports following text commands:
Admin commands:
Jira oauth commands:
Please read Jira OAuth to understand how to configure Jira before using Jira OAuth in jira-telegram-bot.
You must provide next properties to use Jira OAuth in jira-telegram-bot :
/auth
telegram command will be allowed after all properties configured properly .
To notify issues watchers about events jira-telegram-bot must get watchers list via Jira REST API.
You must provide next properties to use Jira REST API in jira-telegram-bot :
You can access prometheus metrics by url:
{host:port}/actuator/prometheus
Jira bot comes with next custom counter metrics:
Integration with Vault
was made using spring-cloud-vault.
By default jira-telegram-bot
integration with Vault
disabled.
To enable integration with Vault
pass following arguments to jira-telegram-bot
run command:
java -jar jira-telegram-bot.jar --spring.cloud.vault.enabled=true --spring.cloud.vault.uri=<your vault uri>
--spring.cloud.vault.token=<your vault token> --spring.cloud.vault.kv.application-name=<vault application name>
You can add any tag to table tags
.
Any tag can be linked to any user via chats_tags
table.
Issue commented with message hello @devs
will be recieved to all users with tag devs
.
There are only one tag exist by default - @everyone
. Using @everyone
you can send notification to all users.
jira-telegram-bot
bot provides simple REST API under /api
mapping.
Supported requests:
POST /api/send/all
- sends message to all users.Body:
{
"message" : "any supported telegram markdown message"
}
Feel free to contribute. New feature proposals and bug fixes should be submitted as GitHub pull requests. Fork the repository on GitHub, prepare your change on your forked copy, and submit a pull request.
IMPORTANT!
Before contributing please read about Conventional Commits / Conventional Commits RU