This document describes how to configure the transaction synchronization feature.
The transaction sync service integrates with:
- ✅ Google Sheets - Data storage and reporting
- ✅ Brex - Corporate card transactions
- ✅ Stripe - Payment processing transactions
- ❌ PrivatBank - Removed (Ukrainian bank, not needed)
- Spreadsheet: https://docs.google.com/spreadsheets/d/1FFajYkLr2P-ubokaotd7ccKUSDpcO9cSvOaCa-plm2c/
- Service Account: Place
service-account.jsonin./credentials/ - Environment Variable:
GOOGLE_SHEETS_SPREADSHEET_ID=1FFajYkLr2P-ubokaotd7ccKUSDpcO9cSvOaCa-plm2c
Add to .env:
# Stripe (optional)
STRIPE_SECRET_KEY=sk_live_...
# Brex (optional)
BREX_API_KEY=your-brex-api-key/transactions
curl http://localhost:3002/telegram/test-transactions# Test connections only
npm run test-connections
# Run full sync
npm run sync-transactions- Initialize: Connect to Google Sheets using service account
- Fetch: Get transactions from each configured API
- Filter: Remove duplicates by checking existing transaction IDs
- Sync: Add only new transactions to Google Sheets
- Report: Generate summary with counts and errors
Each transaction includes:
id- Unique identifierdate- Transaction date (ISO format)amount- Amount (normalized to base currency)currency- Currency code (USD, EUR, etc.)description- Transaction descriptiontype- 'income' or 'expense'category- Auto-categorized transaction typeaccount- Source account/service namereference- Additional reference data
- Missing API keys → Skip that service gracefully
- Network errors → Retry with exponential backoff
- Google Sheets errors → Log and continue
- Duplicate transactions → Automatically filtered out
- Service account key is never committed to git
- All credentials stored in ignored
./credentials/directory - Production uses environment variables or platform secrets
- API keys are optional - missing keys just skip that service
The transaction sync works in production without external dependencies:
- No
npm spawnprocesses - Pure TypeScript service integration
- Docker-compatible credential management
- Proper error handling for missing configurations