Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Latest commit

 

History

History
86 lines (60 loc) · 2.92 KB

File metadata and controls

86 lines (60 loc) · 2.92 KB

Trello price reports collector bot

Simple accounting in trello comments. Bot which shows expenses and incomes report collected from trello specified Board comments for current or previous month:

Arabica Coffee-11.00
Arabica Coffee - 11.00            // you can add whitespaces at any place
Arabica Coffee-  11,00            // you could use comma
Arabica Coffee - 11.00 x 2        // you can define x2 items
Arabica Coffee-12x1               // x1 assumed by default
-Arabica Coffee -11.00 x 10       // minus means expenses (assumed by default but you can explicitly specify it)
- Arabica Coffee -11.00x 2
+ Income from sell furniture - 2100.0
+Income from sell furniture - 2100 x3

Bot generates XLS report and summary.

Use this button to install it into workspace:

Add to Slack

For developers

If you want to tune bot, next section describes how to redeploy it.

How to deploy app and bot

Basically you need to start node index.js (demonized) and pass required env variables or create .env file with these variables in execution folder. Check .env.sample to list of required environment variables.

If you want to host locally for developing purposes use: ngrok http {PORT}

Then you need to create Slack app at https://api.slack.com/apps/, go to Interactive Components and point Request URL to http(s)://deployed_domain(:or your port)/trellocollector

You also need to add 2 actions:

To get TRELLO_BOARD_ID

Get board link https://trello.com/b/12daFy0n/office

replace /office with /reports.json and visit link, e.g. :

https://trello.com/b/12daFy0n/reports.json

first id param will be board id

Deploy bot to Docker

We have also Dockerfile. If you are using docker-compose you can write config like this

  slackcollectorbot:
    build: ../trello-price-reports-collector-bot
    environment:
      # variables from .env.sample
      - DEBUG=express:*  # if you want to see bot proxied requests in logs
    restart: always
    ports:
      - "8589:8589"  # for security specify ports only if you have no proxy behind, this will expose ports outside
    volumes:
      - slackbotdb:/db/
      
  volumes:
    slackbotdb:

Then if you have some proxy on docker host (e.g. Nginx), you can redirect requests like this:

server {
  listen 80;
  # ssl configs here if needed
  server_name bots.devforth.io;

  location /trellocollector {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_pass http://slackcollectorbot:8589/trellocollector;
  }
}