/trello-budget

:money_with_wings: Insert entries into your Google budget spreadsheet by creating Trello cards.

Primary LanguageJavaScriptMIT LicenseMIT

Trello Budget

Quickly insert transactions in your budget spreadsheet by creating a Trello card.

Walkthrough

Check out the YouTube playlist for a complete walkthrough on building this project.

Installation & Configuration

Generate Auth Token for Spreadsheets

  1. Create a new Firebase project called budget.
  2. pip3 install --upgrade google-api-python-client oauth2client
  3. Follow quickstart guide step 1 to enable the Google Sheets API and download credentials for your Firebase budget project .
  4. Copy the credentials.json file in project directory and run the following to generate token.json:
    python3 createtoken.py

Set Up the Firebase CLI

  1. Install Node.js & npm
  2. npm install firebase-functions@latest firebase-admin@latest --save
  3. sudo npm install -g firebase-tools

Initialize Firebase SDK for Cloud Functions

  1. Run firebase login to authenticate the firebase tool.
  2. Make sure that your Firebase project name & ID are correctly configured in .firebaserc:
    {
        "projects": {
            "budget": "<project-ID>"
        }
    }
  • Run npm install from the functions directory.

Create a Trello Webhook

Set the following fields in webhook.sh & run it to create a Trello webhook:

  • APIToken
  • APIKey
  • CallbackURL
  • ModelID
./webhook.sh

Configure

  • Create a new collection called config in your Cloud Firestore and create a document called auth in it.
  • Set your username, password & trello secret in your environment configuration:
    # set admin username & password
    firebase functions:config:set admin.username="utku" admin.password="ilikebananas"
    
    # set trello secret
    firebase functions:config:set trello.secret="<YOUR_TRELLO_SECRET>"
  • Also create an .runtimeconfig.json file inside functions directory and set the same username & password in it as well:
    {
        "admin": {
            "username": "utku",
            "password": "ilikebananas"
        }
    }
  • Finally make sure to set LOCAL_PORT correctly in post.py while serving functions locally.

Serve Locally or Deploy to Cloud

Serve functions locally without deploying functions to cloud:

# default port is 5000
sudo firebase serve --only functions --port=5123

Deploy functions to cloud:

firebase deploy --only functions

Invoke Functions

Local Endpoint

# set spreadsheet ID by URL
python3 post.py local setSheet <SPREADSHEET_URL>

# set auth token
python3 post.py local setToken token.json

# make a transaction request
python3 post.py local transaction trello.json

Remote Endpoint

# set spreadsheet ID by URL
python3 post.py remote setSheet <SPREADSHEET_URL>

# set auth token
python3 post.py remote setToken token.json

# make a transaction request
python3 post.py remote transaction trello.json

References