Serverless Finance

1 min read serverless

Written in 2021. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/serverless-finance.

send balance in google sheets to SMS notification phone numbers. runs daily. SMS numbers stored in SSM parameter store.

  • access to google sheets doc is via Google APIs Node.js Client. OAuth is used to authenticate and the first time requires user interaction. credentials.json contains the OAuth details and token.json contains access_token, refresh_token, etc.
  • you must generate credentials.json and save in the root
  • token.json is created on first run and required manual interaction
  • To update functon with token.json, run locally which will generate token.json, then deploy.

Running

# install deps
npm install

# copy `.env.sample` and update
cp .env.sample .env

# run tests in watch mode
npm run test -- --watch

# run tests
npm run test

# deploy
npm run deploy

# manual run of `notifySubscribers` function
SLS_DEBUG=* ./node_modules/.bin/serverless invoke --function notifySubscribers

TODO

  • store and maintain token.json contents in secrets manager

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.