Serverless Finance
1 min read
serverless
code for article 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.jsoncontains the OAuth details andtoken.jsoncontainsaccess_token,refresh_token, etc. - you must generate
credentials.jsonand save in the root token.jsonis created on first run and required manual interaction- To update functon with
token.json, run locally which will generatetoken.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.jsoncontents in secrets manager