<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kimenye on Medium]]></title>
        <description><![CDATA[Stories by Kimenye on Medium]]></description>
        <link>https://medium.com/@kimenye?source=rss-2d6156d5ac71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wxuOtIOLZQ2GyGZV.jpeg</url>
            <title>Stories by Kimenye on Medium</title>
            <link>https://medium.com/@kimenye?source=rss-2d6156d5ac71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:07:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kimenye/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building the M-PESA charges bot]]></title>
            <link>https://medium.com/lets-ongair/building-the-m-pesa-charges-bot-c63f66822870?source=rss-2d6156d5ac71------2</link>
            <guid isPermaLink="false">https://medium.com/p/c63f66822870</guid>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[conversational-commerce]]></category>
            <dc:creator><![CDATA[Kimenye]]></dc:creator>
            <pubDate>Fri, 15 Sep 2017 13:59:43 GMT</pubDate>
            <atom:updated>2017-10-23T15:31:04.389Z</atom:updated>
            <content:encoded><![CDATA[<p>The promise of conversational interfaces is a simple, convenient way to access services and interact with the connected world in much the same way we humans communicate. At <a href="https://ongair.im/">Ongair</a> we’re re-inventing customer service and business to consumer communication using messaging as a medium and Artificial Intelligence to help businesses provide faster and better responses to their customers. We recently put this to test by tackling one of the pain points experienced by M-PESA users everyday — discovery of the charges associated with using this convenient money transfer service (<a href="https://www.safaricom.co.ke/personal/m-pesa">M-PESA</a> is a Kenyan payment service where customers can send money and pay for goods and services through their phones).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ck_U5j4brLnG3NzaYcwDog.jpeg" /><figcaption>People Transacting at an MPESA agent. Photograph by Trevor Snapp — Bloomberg/Getty Images</figcaption></figure><h4>The Back Story</h4><p><em>Caro needs exactly 1,000 sh (~ 10USD) to pay for something and asks her brother Mato for help. He wants to send her 1,000 sh but remembers that when Caro withdraws the money from her mobile wallet to cash, she will be charged a withdrawal fee — in this case 27sh. So he needs to send 1,027 sh. He is also going to be charged a fee to send the money in the first place. How much money does Mato need in his M-PESA wallet to be able to complete this transaction?</em></p><p>The above calculation is one which many Kenyans have been making for years, mentally keeping track of the sending and withdrawal fees for different amounts (See the rates table online <a href="https://www.safaricom.co.ke/personal/m-pesa/getting-started/m-pesa-rates">here</a>). It has even spawned a Kenyan saying — “Tuma na ya Kutoa” which is roughly translated to “Include the withdrawal fees when you send me money”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yf7kuLPCRLaeIU-p3qMF2w.jpeg" /><figcaption>Include the withdraw fees when you send me money — Image Credit: Peperuka</figcaption></figure><h4>Mapping the Problem</h4><p>Our first step in looking at this problem, was to focus on the user (Mato in this case) and what options were available to him. For small amounts, which make the bulk of peer to peer payments, most people have memorized the withdrawal fees for certain bands. For example, 100 — 2,500sh costs 27sh to withdraw. Another key data source is the tariffs as displayed prominently at M-PESA agents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*26jmm94ASVwQNVmKy9qqsw.jpeg" /><figcaption>M-PESA Tariffs at an Agent</figcaption></figure><p>The above image shows what an M-PESA user would see before transacting at an outlet. If Mato wasn’t at an outlet and had an internet connected device, his likely next option would be to go to Google. <a href="https://trends.google.com/trends/explore?q=mpesa%20charges">Google search trends</a> reveal strong interest especially around withdrawal charges.</p><h4>Designing the Solution</h4><p>We distilled this problem to the the question :</p><blockquote>‘How much do I need to send 1,000 shillings and cater for the withdrawal fees?’</blockquote><p>The system would then respond with the following output:</p><blockquote><em>You need to send 1,027ksh incl. withdrawal fees of 27ksh. This will cost you 25ksh. You need a total of 1,052ksh</em></blockquote><p>Here’s our working. Take the input amount, add the withdrawal fees then calculate how much it would take to send the aggregate amount. In this case, catering for the withdrawal fees moves the sending amount from the 501–1,000sh band which costs 15sh to the 1,001–1,500sh which costs 25sh.</p><h4>Prototyping</h4><p>Once we had a clear problem defined and our solution, our next step was figuring out what was the best way to deploy this solution. There were already some interesting existing approaches to solving this. Here’s a few we reviewed.</p><ul><li>Twitter user <a href="https://medium.com/u/f71369979e1">Elvis</a> has built an <a href="http://stuff.levisdoban.com/mpesaopt/">interesting utility</a> that helps you optimize your transactions for the lowest charges.</li><li><a href="https://mledger.safaricom.com/">M-Ledger</a> an app acquired by Safaricom provides several utilities to calculate this. The recently launched M-PESA app by Safaricom available on smartphones also shows you the transaction fee before you send, but doesn’t provide a simple way of figuring out how much the withdrawal fee is.</li></ul><p>Eventually we were guided by the <a href="https://trends.google.com/trends/explore?q=withdrawal%20charges%20mpesa">Google search trends</a> and our aim to make it a one step process of entering the input and getting a quick result. We decided to build a chat-bot that could handle such enquiries in natural language.</p><h4>Introducing the M-PESA Fees Bot</h4><p><a href="https://telegram.me/mpesafeesbot">Mpesa Fees</a></p><p>The bot is available today on Telegram. Our choice for Telegram was really about convenience and speed of deployment. We quickly launched this on Twitter by asking people to help us test it out and were overwhelmed by users, making it our most popular bot by far.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*dEWj_ndYW_CrjuDvQ5mqAQ.jpeg" /><figcaption>The bot welcome screen with simple instructions for what it can do</figcaption></figure><h4>How it works</h4><p>The bot is deceptively simple in its operation. Its input is the phrase with the user’s question. Here are the steps:</p><ol><li>Classify the enquiry (Intent discovery)</li><li>Extract the amounts involved</li><li>Calculate the fees</li><li>Response to the user.</li></ol><p>The challenging, and quite interesting part for us was the many permutations that Kenyans could use to provide the input. This varied from grammatically correct English, Swahili, Sheng (slang) to some people just sending the amount. We also needed to be able to handle the various ways people referred to money (1000KES, 1000ksh, 1000 kes, 1k, a thousand e.t.c.)</p><p>This was a problem that lent itself to both machine learning and rule based approaches. Both applications are presented in some detail below.</p><h4><strong>Intent Discovery</strong></h4><p>This answers the question — <em>What is the intent expressed in the user’s message</em>. <em>Are they asking about withdrawal fees or just sending fees</em>. This allows us to handle only enquiries that match our intent. It was tempting to being with a keyword based approach like fuzzy matching for keywords such as Withdraw and Send but quickly discarded this approach as the different permutations increased.</p><p>We settled on a supervised learning approach that compared similarity of input text to a set a sample enquiries. This is further weighted by the presence of particular entities (in this case the amount).</p><p>Here a some of the training examples used:</p><ul><li>I want to send <strong>1000 ksh</strong> (English)</li><li>How much to send <strong>3k</strong> (English)</li><li>Ni how much kutuma <strong>thao</strong> (Slang — How much to send 1,000 shillings)</li><li>Nataka kutuma <strong>elfu tatu</strong> (Swahili — I want to send 3,000 shillings)</li></ul><p>At the beginning a lot of valid phrases were not being matched by our classifier. We begun with 15 training examples, and quickly devised a system where frequently unmatched examples were reviewed and added to the training set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*3tPx0MZcanJAAhalH1Gz3g.jpeg" /><figcaption>Learning Swahili.</figcaption></figure><h4><strong>Entity Extraction</strong></h4><p>This is the process of resolving the transaction amount involved given a phrase. We were quite surprised by the various ways to describe amounts in Shillings. Here’s just a few examples for 1,000 shillings:</p><ul><li>one thousand shillings</li><li>1k, a k, a gee</li><li>a thao,ngiri — <em>slang</em></li><li>1,000</li><li>1,000sh / 1000shs</li><li>1000kes</li><li>1000ksh / 1000kshs.</li><li>elfu moja — swahili</li></ul><p>It gets a lot more interesting when looking at multiples of amounts, for example, 5,050 shillings. Here’s are real world interaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*4p1sOSKZzwOzQOLzHqn_Ug.jpeg" /><figcaption>An example where a user is conversing with the bot in Sheng (a Swahili and English slang)</figcaption></figure><p>To overcome this challenge we used a ML based slot filling approach and a rule based approach for some of the numerical formats. We ended up building a training model for local currency detection that we will open source shortly.</p><h4>Lessons Learnt</h4><p>Perhaps the biggest lesson we’ve learnt is to launch early and get it in-front of real users. Not only were we able to crowdsource our training data especially for the currency detection, but we were also able to uncover new intents by looking at user behavior. For example, at launch we did not explicitly cater for people who just wanted to know what the withdrawal fees — but quickly looking at the user data we were able to see that this was in demand and implemented this. Our roadmap for this bot is now governed by what questions users are asking.</p><h4>Looking for a custom bot?</h4><p>If you would like to explore how conversational experiences can make it easier for your customers to get quick answers to their customer service issues and enquiries, drop us a line at <a href="/service/mailto: hello@ongair.im">hello@ongair.im</a>, or chat with us on <a href="https://m.me/letsOngair">Messenger</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c63f66822870" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lets-ongair/building-the-m-pesa-charges-bot-c63f66822870">Building the M-PESA charges bot</a> was originally published in <a href="https://medium.com/lets-ongair">Lets Ongair</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing #Uchaguzi2017 Bot]]></title>
            <link>https://medium.com/lets-ongair/introducing-uchaguzi2017-bot-7c5907e8ecce?source=rss-2d6156d5ac71------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c5907e8ecce</guid>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[elections-in-kenya]]></category>
            <dc:creator><![CDATA[Kimenye]]></dc:creator>
            <pubDate>Sat, 05 Aug 2017 14:45:20 GMT</pubDate>
            <atom:updated>2017-09-21T10:36:57.811Z</atom:updated>
            <content:encoded><![CDATA[<p>Get to Know your candidates for the 2017 Kenyan Election</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xipTlJIAU5xozgHybwpOA.jpeg" /><figcaption>A voter identifying themselves (Photo Credit — Brookings Institute)</figcaption></figure><p>As Kenya gets ready for its most contested election in its young history, we at <a href="https://ongair.im/">Ongair</a>, and one of our <a href="https://twitter.com/benaboki">friends</a>, were thinking of a way to make discovery of the candidates a bit easier for those who are researching who to vote for. Here’s why:</p><p>Every voter will have 6 positions to vote for: President, Governor, Senator, County Woman Representative, Member of National Assembly and County Ward Representative. There are 14,522 nominees (excluding running mates) seeking electoral office. Many voters will encounter some of these names on the ballot paper on the day itself. The Independent Electoral Boundaries Commission (IEBC) posted the Gazetted list of candidates on their website, in <a href="https://www.iebc.or.ke/uploads/resources/17umEj7cBg.pdf">PDF</a> — It’s 438 pages long and 119Mb in size.</p><p>We saw an opportunity to create a conversational way to digest all this information, in a simple way that would be familiar to Kenyans. Just ask, “Who’s is running for Governor in Nairobi?” or even “Kisii Women Reps” — to get the list of County Woman Representative Candidates in Kisii county.</p><p><a href="https://t.me/uchaguzibot">#Uchaguzi2017</a></p><p><a href="https://t.me/uchaguzibot">UchaguziBot</a> is currently only available on <a href="https://telegram.org/">Telegram</a>. We’ll be releasing a Facebook Messenger bot shortly. We would have loved to be able to do this on <a href="https://whatsapp.com/">WhatsApp</a>. It is by far the largest social platform in Kenya with over 12M active users, but they have no API to make this possible.</p><p>Special shout out to IEBC for the original source data on candidates &amp; <a href="https://twitter.com/benaboki">Benedict Omare</a> (for converting the PDFs into CSVs and cleaning up the data).</p><p>#ElectionsKE</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c5907e8ecce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lets-ongair/introducing-uchaguzi2017-bot-7c5907e8ecce">Introducing #Uchaguzi2017 Bot</a> was originally published in <a href="https://medium.com/lets-ongair">Lets Ongair</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>