In this project, I set out to solve a simple but important challenge β€” tracking personal M-PESA transactions directly from SMS messages. What started as an automation experiment evolved into a full-fledged, cloud-powered financial monitoring system, complete with a visual dashboard and analytics capabilities.

This article outlines the journey, technologies used, insights gained, and how this system can help individuals and small businesses improve cash flow visibility and tax reporting in Kenya.


πŸ”§ Project Overview

πŸ“± SMS Capture with Automate

I used the Automate Android app to detect incoming M-PESA messages. Each time a message is received, it is parsed locally using regular expressions and transformed into a structured JSON object.

Example fields extracted include:

  • Transaction type (sent/received/payment)
  • Amount
  • Sender/Recipient name and phone
  • Balance
  • Timestamp

These structured payloads are queued and forwarded to AWS SQS (Simple Queue Service) for reliable delivery.


☁️ Cloud Backend with AWS Lambda and PostgreSQL

Once the messages land in SQS, a Lambda function is triggered to:

  1. Parse and clean the message further if needed
  2. Insert the transaction into a PostgreSQL database hosted on Amazon RDS

Why Lambda? It’s scalable, serverless, and cost-effective. By decoupling ingestion and storage, I ensured that even if my phone is offline, no data is lost β€” SQS buffers the messages.


πŸ“Š Visualizing the Data with Grafana

With the data in PostgreSQL, I connected Grafana to build a dynamic dashboard showing:

  • Total Sent vs Received
  • Daily Spend Over Time
  • Latest M-PESA Balance
  • Top Recipients
  • Recent Transactions Table

This dashboard gives me real-time visibility into my spending habits and helps flag anomalies or unexpected expenses.


🧠 What I Learned

  • AWS Services Integration: SQS + Lambda + RDS makes a powerful pipeline for event-driven processing.
  • Regex Mastery: Fine-tuning regex to extract structured fields from semi-structured SMS data was challenging but rewarding.
  • Grafana Dashboarding: I learned how to use PostgreSQL queries to generate valuable visualizations and aggregate metrics.
  • Cost Optimization: Using serverless and open-source tools keeps the project affordable to run long-term.

πŸš€ Future Improvements & Real-World Use

This project is not just for personal use β€” it has the potential to evolve into a microfinance analytics platform for small businesses, offering:

  • πŸ’° Cash flow tracking
  • 🧾 Receipts and expense categorization
  • πŸ“ˆ Profitability insights
  • πŸ“„ Tax filing assistance for informal traders

πŸ“‘ Can We Support Mulika Mwizi (Feature Phones)?

Most informal business owners in Kenya use feature phones. I’m exploring ways to support those devices, for example:

  • Using USSD apps or SMS relays
  • Interfacing with GSM modems or Raspberry Pi
  • Partnering with telcos or gateways for SMS mirroring

Have ideas on how to bring feature phones into the AWS ecosystem? Let’s connect!


πŸ“¬ Final Thoughts

This project showed me how simple tools can be combined to deliver real financial value. From mobile automation to serverless processing and data visualization β€” it was an exciting end-to-end build.

πŸ“’ If you’re working on similar projects or have ideas for improving this β€” especially around integrating feature phones β€” feel free to comment or DM me!

Let’s make tech more inclusive and impactful. 🌍


Β 

Leave a Reply