Financial APIs like Plaid are great, but their data structures are built for accountants, not normal humans.
Today, I rewrote the notification engine for my AI Agent.
The Problem
My Lambda was sending emails that looked like a raw JSON dump. Refunds appeared as negative numbers (-4.22€), and expenses were mixed with income.
The Fix
I built a dynamic HTML builder in Python that conditionally renders sections based on the day's payload:
Separate transactions and fix signs
for t in transactions:
amount = float(t['amount'])
if amount < 0 or is_income_keyword(t['description']):
income_txs.append(t)
else:
expense_txs.append(t)
Conditionally render HTML
if income_txs:
html += "
Income / Credits
"# Format negative API floats to positive UX strings
html += build_rows(abs(amount), color="#10b981")
Now, the emails are cleanly divided, visually color-coded, and highly readable. Plus, the AWS EventBridge orchestrator now perfectly balances hourly SMS alerts with the 9:00 AM daily SQS report.
Never underestimate the power of formatting your data before passing it to the user (or to the LLM!).

Top comments (0)