Recognize Transaction Codes, Amounts, and Counterparties from Any M-Pesa SMS Format
M-Pesa confirms every transaction with one of five different SMS templates — Send Money, Pay Bill, Buy Goods, Money Received, and Withdrawal. Define your columns once; the AI reads the transaction code, amount, counterparty, and date from each format without a single template.
5-10s per SMS screenshot · Up to 99% accuracy on printed text
What You Can Pull from an M-Pesa SMS
An M-Pesa confirmation is a plain 160-character SMS — no app UI, no visual layout. With Custom Column Extraction, you name the fields and the AI finds them across all five formats by meaning, not by position.
A 10-character code that begins every SMS. First 3 characters encode the date (T = 2025). Reconciliation key for deduplication and KRA reference.
Formatted as Ksh1,500.00. The AI separates it from the transaction cost and new balance — the other two Ksh figures in the same message — by reading the label beside each.
Changes by transaction type: full name on Send Money, business with account on Pay Bill, merchant name on Buy Goods, or sender on Money Received. Semantic extraction identifies it by role, not by keyword.
Every SMS includes a timestamp (on 23/6/25 at 3:41 PM) in East Africa Time. Saved on the device indefinitely — permanently available for records and reconciliation.
M-Pesa Doesn't Use an App Screen — It Uses Five SMS Templates
M-Pesa was built for a market where not everyone owns a smartphone. The receipt is a plain SMS — no visual UI — and the same four fields rearrange across five message formats. Template-based tools and screen OCR fail because they expect visual structure; here is what they miss.
Why M-Pesa Breaks Traditional Extraction
No app UI to anchor fields. Venmo and PayPal have visual screens with layout cues. M-Pesa's receipt is a raw SMS — no bold headers, no colour. OCR tools designed for app interfaces fail because there is nothing to anchor visually.
Three Ksh figures, one message — only one is the amount. The transferred amount, transaction cost, and new balance all share the Ksh prefix. Regex rules that grab "the number after Ksh" routinely pick the wrong figure. Developers parsing M-Pesa SMS with regex must isolate the correct Ksh occurrence per message type — a fragility that breaks across formats.
Counterparty format shifts per transaction type. "Sent to JOHN DOE 0722000000" names a person. "Paid to Naivas Supermarket" names a merchant. "AC for account 1137238445" is a Pay Bill. One regex rule cannot handle all three because the grammatical structure is different for each format.
How Semantic Extraction Reads Any M-Pesa SMS
The transaction code is always the first word. Every M-Pesa SMS begins with a 10-character code followed by "Confirmed." The AI uses this consistent opening as its anchor — it reads the message as text, identifies the code by position, then builds the rest of the extraction from there.
Labels determine what each Ksh figure means. "Transaction cost, Ksh6.00" is tagged as a fee. "New M-PESA balance is Ksh1,205.10" is tagged as a balance. Only the value preceded by "sent to" or "received" goes into the Amount column — three semantically different figures resolved without position assumptions.
Counterparty is identified by semantic role. Whether the SMS says "sent to JOHN DOE", "paid to Naivas Supermarket", or "received from MICHAEL FEDERSEN", the AI maps the entity on the other side of the transaction to the Counterparty column. It reads the relationship, not the position of a specific keyword.
"I've been noticing something while talking to a few businesses (schools, rentals, small finance teams) — reconciliation gets messy very fast once volume picks up."
— r/nairobitechies discussion on M-Pesa + bank reconciliation
From Mixed M-Pesa SMS Formats to One Clean Spreadsheet
Upload M-Pesa SMS Screenshots Together
You have a folder of M-Pesa confirmations from the past week: a Send Money receipt from a client, a Pay Bill SMS from the school fees payment, a Buy Goods confirmation from the supermarket, and a Money Received notification from a supplier. Four different SMS formats. Upload them all into one batch — JPG, PNG, or WebP screenshots of the SMS thread.
Define Columns Once — Transaction Code, Amount, Counterparty, Date
Type the columns you need. The AI reads each SMS screenshot independently: it finds the 10-character transaction code as the opening word, isolates the transferred Ksh amount (not the fee or balance), identifies the counterparty by its role regardless of whether the verb is "sent to", "paid to", or "received from", and records the date and time.
Get One Unified Table — No Sorting by Type
Processing takes 5-10 seconds per screenshot. The output is one XLSX or CSV: four rows, four columns (Transaction Code, Amount, Counterparty, Date), one row per transaction type. The Send Money, Pay Bill, Buy Goods, and Money Received formats each produced the same clean structure. Roughly 18x faster than opening each SMS and typing the values by hand (~90s manual per SMS for 4 fields vs ~5s here).
What you get — across all five M-Pesa SMS formats:
| Transaction Code | Amount (Ksh) | Counterparty | Date |
|---|---|---|---|
| ABCDE12345 | 1,500.00 | JOHN DOE | 23/06/25 |
| DY28XV679 | 4,000.00 | KCB Paybill | 09/09/25 |
| GH78KT901 | 500.00 | Naivas Supermarket | 15/01/26 |
When It Works Best — and When to Be Cautious
Understanding the boundaries of SMS screenshot extraction helps you get consistent results.
When It Works Best
Direct device screenshots of SMS threads or the Super App. Full-resolution screenshots of the message inbox or Super App transaction history achieve up to 99% accuracy. Machine-rendered SMS text is high-contrast — the model handles it well.
Mixed transaction types in a single batch. Send Money, Pay Bill, Buy Goods, and Withdrawal screenshots can be uploaded together — no need to sort by type before processing.
Bulk historical reconciliation. Dozens of M-Pesa confirmations produce a single sorted spreadsheet, ready for import into QuickBooks Kenya or Zoho Books.
When to Be Cautious
Forwarded screenshots through WhatsApp or Messenger. Messaging platforms compress images. Forwarded screenshots have lower resolution that may reduce character-level accuracy, especially for the transaction code.
Architecture boundary: screenshot of SMS, not SMS data feed. This approach works with screenshots — forwarded receipts and images others send you — but cannot parse SMS directly from the phone's message database. It complements SMS-reading tools rather than replacing them.
Very old M-Pesa SMS formats. Transaction codes shifted from S-prefix to T-prefix in 2025. The AI handles known variations, but much older formats may produce partial results.
Frequently Asked Questions
How does the AI distinguish between the transaction amount, the fee, and the new balance in an M-Pesa SMS?
Every M-Pesa SMS carries three Ksh figures. The AI reads the label that precedes each value: Ksh1,500.00 sent to is the transferred amount; Transaction cost, Ksh6.00 is the fee; New M-PESA balance is Ksh1,205.10 is the remaining balance. Only the value that is the subject of the transaction — preceded by action verbs like "sent to", "paid to", or "received" — goes into the Amount column. This prevents the confusion that occurs when scanning the message manually.
Does the transaction code really encode the date — and why does that matter?
Yes. The first character of the M-Pesa transaction code represents the year (T = 2025, S = 2024, cycling through the alphabet), the second represents the month, and the third represents the day. This means the Transaction Code field alone can confirm the transaction date even when the SMS timestamp is cropped out of the screenshot. It also serves as the universal reconciliation key: two SMS messages with the same code are the same transaction, making it the most reliable field for deduplication and KRA reference.
Can I process both plain SMS screenshots and M-Pesa Super App screenshots in the same batch?
Yes. The M-Pesa Super App displays the same data — transaction code, amount, counterparty, date — in a visual confirmation screen. The AI handles both input formats in a single batch. The Super App screen may display the merchant name more legibly than the SMS, while the SMS includes the transaction cost and new balance that the app screen sometimes omits. Define your columns once; the AI adapts to whichever source each screenshot comes from.
Can I use the extracted data for KRA tax filing?
KRA accepts M-Pesa statements as supporting documentation for tax filings, particularly for small businesses that operate primarily through mobile money. Each transaction is indexed by its Transaction Code, which ties a specific payment to the KRA's records. For formal filing, you will still need the full M-Pesa PDF statement (available by dialling *234# or through the Super App), but extracted SMS data gives you a working spreadsheet for interim reconciliation and expense tracking before the official statement arrives.
What if I need to extract data from a hundred M-Pesa confirmations at once?
Batch processing supports multiple screenshots in a single upload. Upload all SMS screenshots together, define your four columns — Transaction Code, Amount, Counterparty, Date — and the AI processes every screenshot using the same column definitions. Whether the batch contains 10 or 100 mixed-format M-Pesa confirmations, the output is a single Excel file with one row per transaction, ready for import into accounting software or reconciliation with your ledger.
Deep dive into M-Pesa's five SMS formats: See all supported payment apps and how they compare · How to extract the transaction code, amount, and counterparty from M-Pesa's five SMS confirmation formats