Skip to content
💸 Insert entries into your Google budget spreadsheet by creating Trello cards.
JavaScript Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
functions
.firebaserc
.gitignore
LICENSE
README.md
createtoken.py
firebase.json
post.py
spreadsheet_ids.png
trello.json
webhook.sh

README.md

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

  1. Create a new board and 12 lists inside it for each month (Jan, Feb, Mar, ...)
  2. Set the following fields in webhook.sh & run it to create a Trello webhook for your budget board:
    • APIToken
    • APIKey
    • CallbackURL
    • ModelID
    ./webhook.sh

Configure

  • Create 12 monthly budget spreadsheets to keep track of each month and take note of corresponding spreadsheet IDs.
  • Create a new collection called config in your Cloud Firestore and create a document called spreadsheet in it.
  • Add 12 fields inside the spreadsheet document for each spreadsheet ID as follows: Spreadsheet IDs
  • 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 auth token
python3 post.py local setToken token.json

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

Remote Endpoint

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

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

References

You can’t perform that action at this time.