Community
Dennis Kipkorir
Dennis KipkorirTech
Oct 15

Built a simple tool that tracks M-Pesa payments for my side hustle

I got tired of going through my M-Pesa messages to remember who paid me for the stuff I sell on WhatsApp. So I made a small tool that reads the SMS notifications and puts them into a list showing name, amount and time. Nothing fancy, just a simple way for me to know who has paid and who is still owing. The thing that got me stuck was dealing with the different ways M-Pesa writes the messages. Sometimes the name comes first, sometimes the amount is in a different format. I ended up testing it with my old messages from last month and just having a few examples to match against. That helped a lot. If you have a small hustle and deal with payments, feel free to ask me anything. I am happy to share how it works, even if you are new to coding. There is no silly question here.

6

Replies

6
Grace Wambui
Grace WambuiOct 15

Testing with last month's messages is such a good move, that's how you catch those weird format changes without needing to guess. For anyone reading this who wants to try something similar but feels lost, you could start even smaller: just copy a few M-Pesa messages into a Google Sheet and sort them manually first. That alone helps you spot the pattern before you write any code. Also, do you share the list with your customers so they can see their own payment status, or is it just for you?

Halima Abdi
Halima AbdiOct 15

That's really cool. I run a community programme for young women here in Mombasa, and a bunch of them do small side hustles like you. Honestly, something this simple could save them so much headache. Does your tool handle when someone pays using a different network like Airtel Money, or does it only work with M-Pesa messages?

AM
AmaniOct 15

Hey, this is a smart way to keep your side hustle organised. One thing that might help with the different message formats is using regex patterns that look for keywords like "received" or "from" to pull out the name and amount, have you tried that yet?

Esther Nyambura
Esther NyamburaOct 15

Nice one! And to the person asking about Airtel Money, I say start with M-Pesa only if that's what your customers use, you can always add other networks later once the flow works. Also love that you tested with last month's messages, that's exactly how I'd tell a beginner to start, no need for fancy rules when real examples do the job.

Achieng Odhiambo
Achieng OdhiamboOct 15

Good on you for testing with last month's messages, that's the real MVP move. For anyone else trying this, you can also export your M-Pesa statement from the app as a CSV and practice on that, no need to touch SMS permissions at first. What are you building it in, Google Sheets or something else?

Peter Njoroge
Peter NjorogeOct 15

Nice work! I also run a small side thing selling snacks, and I know the pain of scrolling through messages. For the different M-Pesa formats, you could try just looking for the number that starts with "Ksh" then grab whatever comes after "from" or "to", that usually works even when the order changes. Also, are you reading the SMS directly from the phone or just copying them in manually? That part always trips me up.