Skip to content

carwin/harvest-notifier

 
 

Repository files navigation

Slack Reminder

Build Status Deploy

Slack Reminder is an integration between Harvest and Slack which automatically reminds users who forget to mark their working hours in Harvest.

This is a Ruby 2.6.5 library for installation on Daily Heroku Scheduler. Notification is determined from Harvest API V2.

Features

There are 3 types of reports: Daily, Monday, and Weekly.

  • Daily Report is generated on weekdays (except Monday) and shows those users who did not fill in their time for that day.

  • Monday Report is generated on Mondays and shows info about the past Friday.

  • Weekly Report is generated every Monday and shows those users who still need to report the required working hours for last week.

This integration allows to:

  • mention users in the Slack
  • refresh report result
  • quickly report the working hours from the link
  • set up custom report schedule
  • configure a whitelist which consists of users, who don't need to be notified in Slack

Example

Quick Start

  1. Prepare access tokens
  • Create Personal Access Tokens on Harvest.

  • Create Slack app. You can find official guide here.

  • Create Bot User OAuth Access Token

  • Add following scopes to Bot:

    chat:write
    users:read
    users:read.email
  • Add app to Slack channel.

  1. Deploy to Heroku

  2. Configure following ENV variables

    heroku config:set HARVEST_TOKEN=harvest-token
    heroku config:set HARVEST_ACCOUNT_ID=harvest-account-id
    heroku config:set SLACK_TOKEN=slack-bot-token
    heroku config:set SLACK_CHANNEL=slack-channel
    heroku config:set EMAILS_WHITELIST=user1@example.com, user2@example.com, user3@example.com
    # EMAILS_WHITELIST is a variable that lists emails separated by commas, which don't need to be notified in Slack.
    # For example, administrators or managers.
    heroku config:set MISSING_HOURS_THRESHOLD=1.0
    heroku config:set MISSING_HOURS_DAILY_THRESHOLD=1.0
    # MISSING_HOURS_THRESHOLD is a variable that indicates the minimum threshold of hours at which the employee will not be notified in Slack.
    # For example, 2.5 or 4. The default threshold is 1 hour. Leave empty if satisfied with the default value.
    heroku config:set TZ=America/New_York
  3. Add job in Heroku Scheduler

  • bin/rake reports:daily for daily report
  • bin/rake reports:monday for monday report
  • bin/rake reports:weekly for weekly report

Support

If you have any questions or suggestions, send an issue, we will try to help you

Quality tools

  • bin/quality based on RuboCop
  • .rubocop.yml describes active checks

Develop

  1. Сlone repo
git clone git@github.com:carwin/harvest-notifier.git
cd harvest-notifier
  1. Setup project
bin/setup
  1. Check specs and run quality tools
bin/build

Credits

This project is a fork from the original Flatstack project with borrowed code from Be Intelligent Ltd's Monday report modifications.

Original Credits

It was written by Flatstack with the help of our contributors.

About

Remind users about missing reports in Slack.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 98.3%
  • Shell 1.7%