Skip to content

agrippa1027/exptracker

Repository files navigation

SMS Ingest Lambda

This project is a Go AWS Lambda container that receives bank transaction SMS payloads over HTTP, parses them with a Python spaCy worker, and appends the parsed transaction to Google Sheets.

Current Behavior

  1. Accepts POST requests only
  2. Validates x-auth-token against the AUTH_TOKEN environment variable
  3. Parses the JSON request body
  4. Resolves the bank config from the SMS sender
  5. Sends the SMS text to the Python parser over stdin/stdout
  6. Appends the parsed transaction to the configured Google Sheet

Request Body

Expected JSON:

{
  "sender": "NationsSMS",
  "message": "A TRANSACTION of LKR 1,185.94 was approved on your A/C No. 200680****580 at UBER EATS CBH. Current Bal LKR 95200.23",
  "received_at": "2026-02-04T12:34:56Z",
  "device_id": "pixel-8"
}

received_at must be RFC3339.

Config

config.yml uses this shape:

spreadsheet:
  url: ""
  sheet_name: Transactions

banks:
  - name: "NTB"
    senders:
      - "^NationsSMS$"

Each bank entry contains:

  • name: bank name written to the sheet
  • senders: one or more sender regex patterns

Environment Variables

  • AUTH_TOKEN: shared secret expected in the x-auth-token header
  • GOOGLE_CREDENTIALS_JSON: Google service account JSON
  • SPREADSHEET_URL: optional override for config.yml spreadsheet URL
  • PARSER_PYTHON: optional Python executable for the parser worker, for example ./.venv/bin/python

Output Columns

Rows are appended to Google Sheets in this order:

  1. received_at
  2. amount
  3. direction
  4. description
  5. account_mask
  6. sender
  7. device_id
  8. bank_name

Local Commands

make test
make vet
make fmt
make build
make docker-build

make build creates dist/lambda/bootstrap.

make docker-build creates the Lambda container image sms-ingest:local.

Local HTTP Testing

Run the app as a normal local HTTP server:

LOCAL_HTTP=1 PARSER_PYTHON=python go run ./cmd/sms-ingest

Or use the Makefile target, which reads .env and defaults PARSER_PYTHON locally:

make run-local

Default local URL:

http://localhost:8080/

You can override the port with PORT.

Example:

curl -X POST http://localhost:8080/ \
  -H 'Content-Type: application/json' \
  -H 'x-auth-token: your-auth-token' \
  -d '{
    "sender":"NationsSMS",
    "message":"A TRANSACTION of LKR 1,185.94 was approved on your A/C No. 200680****580 at UBER EATS CBH. Current Bal LKR 95200.23",
    "received_at":"2026-02-04T12:34:56Z",
    "device_id":"pixel-8"
  }'

TODO

  • Persist parsing errors

About

Automated exp tracker to google sheets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors