Skip to content

Latest commit

 

History

History
85 lines (62 loc) · 2.04 KB

README.md

File metadata and controls

85 lines (62 loc) · 2.04 KB

Slackt > Packt Slack Bot

Slack bot for sending daily free random ebook from Packt Publishing.

Slack preview

Description

  1. Parsing data from Packt Publishing website.
  2. Mapping ebook data to Slack message format.
  3. Executing POST request to Slack webhook url.
  4. Multiple slack workspaces handling.

list preview

edit preview

Stack

  • Backend: Java, Spring Boot, JPA, REST, Jsoup, Lombok, Maven, Swagger, H2 DB, Quartz
  • Frontend: React, Ant Design, Axios, Moment

Build and run Java application with embedded React (localhost:8099)

$ mvn clean install
$ java -jar target/ebook-0.0.1-SNAPSHOT.jar

Develop Java (localhost:8099) and React (localhost:3000):

$ mvn spring-boot:run
$ cd frontend && npm start

Run Java tests:

$ mvn test

Features

  • Configurable parameters in application.properties
  • ReactJs web dashboard with configurable parameters
  • Multiple Slack webhooks handling
  • Configurable cron scheduler with Quartz support
  • H2 single file database

To do

  • Save daily ebook to db, if exists for current day get from db instead of remote request
  • Enums for styles, types, colors etc.
  • Move cron expression to properties
  • Job model with CRUD for managing multiple slack workspaces/channels
  • Swagger UI for documenting REST API
  • ReactJs as UI
  • Frontend validation with notifications
  • Free Ebook - Archive by day (db / page)

Example POST request for creating new job

Example request packt ebook to slack everyday at 13:30 (1:30AM).

Create new slack job in db:

{
  "active": true,
  "botName": "Packt Publishing Bot",
  "channel": "#ebook",
  "createdDate": "2018-06-23T20:27:55.393Z",
  "jobName": "CompanySlack",
  "scheduler": "* 30 13 ? * * *",
  "webhook": "https://hooks.slack.com/services/xxxxxxxxx/yyyyyyyyy/zzzzzzzzzzzzzzzzzzzzzzzz"
}

More information in swagger (localhost:8099/swagger-ui.html):

Swagger preview