harvest-er: Harvest Automation Server
Getting Started
Harvester requires Node.js and npm, which can both be installed by following the instructions on https://nodejs.org/. Installing Node.js also installs npm.
Installing with npm
npm install harvest-er
Installing from source
git clone https://github.com/sbolel/harvest-er
- clone the source code
npm install
- install node dependencies
npm run debug
- start the application using Supervisor with debug messages enabled
Usage
Start the application using Supervisor with npm run debug
. The Harvest data will be downloaded and saved to Dropbox each time the server runs. To re-run this download, execute rs
in Supervisor.
Setting up Harvest
-
Add the admin users email/password to your environment
export HARVESTER_SUBDOMAIN="thinkcrazy"export HARVESTER_ADMIN_EMAIL="admin@thinkcrazy.co"export HARVESTER_ADMIN_TOKEN="abc-def-123-456" -
Set your Harvest subdomain in
server/harvester.js
and the email/password for the admin user:var harvester =subdomain: processenvHARVESTER_SUBDOMAIN // your harvest subdomainemail: processenvHARVESTER_ADMIN_EMAILpassword: processenvHARVESTER_ADMIN_TOKEN
app.js
)
Getting Today's Expense and Time Entries data from Harvest (see - Require
harvest
andharvester
const Harvest = ;const Harvester = ;
- Initialize Harvester and download the data using a promise array
{ const harvest = subdomain: processenvHARVESTER_SUBDOMAIN email: processenvHARVEST_ADMIN_EMAIL password: processenvHARVEST_ADMIN_TOKEN ; const harvester = harvest; const tasks = ; harvester;}
Future work
Setting up Dropbox
-
Create a new Dropbox app at https://www.dropbox.com/developers/apps/create
- Go to the settings for your new Dropbox app
- Take note of the App key and App secret
- Click "Generate" to get a Generated access token
-
Add the admin users email/password to your environment
export HARVESTER_DROPBOX_KEY=2abcdef1234t53eexport HARVESTER_DROPBOX_SECRET=vn5aaf3bb5dd3qtexport HARVESTER_DROPBOX_TOKEN=rUY9dxaAABBCCDDeeXJctUSUA_c8SuvABfzNwDAdFmTACAa6mUrpAAmcc7Gg7Qch -
Set your Dropbox credentials in
server/dropboxer.js
:
const client = key: processenvHARVESTER_DROPBOX_KEY secret: processenvHARVESTER_DROPBOX_SECRET token: processenvHARVESTER_DROPBOX_TOKEN;