Because we want to.

On chatbots, office lunches and doing business in Eastern Africa

For the past month, I have been stationed in Tanzania — just below the Equator line — running the advanced data analytics arm of a VC-backed Dutch solar utilities company.

I believe that numeracy and technological literacy will be the great enablers of this century, and so I jumped at the chance of introducing modern statistics to an audience of college-educated Tanzanian co-workers (the future engineering backbone of this country!), working at a real, for-profit utilities business (not an NGO) in real Africa.

So far, things have not been that simple, as both Tanzania and the company I’m working for have proven to be much more complex than expected. 
In Europe or the US — and especially in the sector I operate in — ‘move fast and break things’ is an acceptable, even celebrated mantra.
Large-scale operations are the norm, and a problem-solving oriented culture means that direct, pre-assembled, container-sized solutions are the way to go for most issues.

But here things are different. In a fragile ecosystem you really need to tread carefully, as any brilliant solution that’s being drafted in the comfort of a Washington D.C. or Geneva office has the potential to utterly destroy any budding form of local economic independence, to curb any chance of transitioning to a self-sustainable model, or even to selectively harm locals in a long-term manner. When an entrepreneur moves fast and fails hard in Europe, he or she has a social safety net to fall back on; a support network to get back on his or her feet, and has acquired a set of marketable skills that allow him or her to move on to the next challenge. When an entrepreneur moves fast and fails hard in Tanzania, it might take him or her many years to even get back to square one — not to mention the social stigma of trying something new and failing in a society that’s utterly devoid of positive entrepreneurship or business role models, and the differential cost of time in a country that has an average life expectancy of 54 — not 82 — years.

- any brilliant solution that’s being drafted in the comfort of a Washington D.C. or Genève office has the potential to utterly destroy any budding form of local economic independence, to curb any chance of transitioning to a self-sustainable model, or even to selectively harm locals in a long-term manner.

To make matters worse, we’re not an NGO or a charity but an actual for-profit business, which puts us under additional pressure to balance our financial indicators with doing the right thing and serving as many people as we can. And of course, there’s also the issue of technology holding us back. Indeed, the ‘taking things for granted’ caveat also applies to technical factors (internet, electricity, spare parts, …) we routinely count on that are simply not reliably there in Tanzania. I could nag on and on about how hard it is to do version control with unstable internet, or distributed databases on a high-latency, low-throughput connection, but this would just bore everyone to tears.

technical jargon? Run for the hills!

So let me walk you all through a concrete example of rolling out a real product in Africa instead! At my job here I mainly do predictive analysis, but since most of the real work I do is covered by non-disclosures and data privacy policies, we’ll do an exceedingly simple chatbot instead. The tutorial should take up to 15 minutes to complete (exponentially more if you’re on an African internet connection), and you’ll end up with your very own culturally inappropriate food bingo bot. The only thing you need is, of course, a working computer and possibly a smartphone. As usual, you don’t need any programming experience and you’re more than welcome to just skim the tutorial without actually following along. So let’s get started!

Part 1: the main ingredients

The idea for the food bingo bot arose as a joke between colleagues concerning the quality (or lack thereof) of the office food supply. Office lunches are a staple of the average startup’s creature comforts arsenal, and the place I’m working at is no exception. Now, Tanzanian cuisine is not that elaborate, but it is decent, and filling as well. From a chunky boiled cornmeal called Ugali, to roasted poultry with spinach; from spicy rice Pilau, to roasted bananas and sweet potatoes, there is an interesting variety and breadth of combinations to what the local pots have to offer, and I rarely miss my home food when cooking local with my flatmates or my friends.

But Jesus almighty, the stuff we get at the office is something else entirely. From a shapeless, tasteless beige glob of sticky corn nothingness, to spicy chicken rice without any spice or chicken, to beef-less beef stew (just a few pale bones idly floating in the pot), and finishing with a chunky paste of chopped black bananas, the office lunch is a nightmarish imitation of what East Africa has to offer, and it’s gotten really, really bad. The straw that broke the camel’s back? I downed a double serving of office lunch, then a diabetes-inducing slice of sugary cake, then a beer and chicken wings for dinner, and in just a few hours I was struck with the worst case of food poisoning I’ve ever seen in my life.

I’ll have a coke and a trip to the hospital, please.

Now, Everyone knows the food is bad. There’s whispers in the halls, and conspiratorial glances at lunch. And of course, the entire staff is on Telegram, making gallows jokes about what’s for lunch. But no one really dares to be the first one to overtly shame the cook (which, incidentally, is the office manager’s mother). It was clear that we needed a way to defuse the tension. And hence, BingoFoodBot was born.

- It was clear that we needed a way to defuse the tension. And hence, BingoFoodBot was born.

How does it work? It’s quite simple actually: anyone at the office can add BingoFoodBot as a contact on Telegram, and ask for the daily horoscope. You get a handy bingo of what’s cooking for you, based on your username and the day of the week. You also get an absolutely arbitrary chance of food poisoning, which aims to keep you constantly aware of the perils of this country. If all four food predictions are correct, you just need to come and find me- after making sure the winner is legit, I hand out a meal voucher to the best take-away restaurant in town (which luckily is still pretty cheap), as a consolation prize for having to endure the office lunch.

Part 2: how the sausage is made.

So, if you want to be part of the BingoFoodBot rebellion and/or make your own Telegram bot, this is where things get interesting. Just follow the steps and you should be good to go!

1. First of all, let’s create the Bot on Telegram. Super easy: open the telegram app and look for the father of all bots: @botfather. Then just create a new bot by texting botfather the command /newbot (easy!). Last but not least, choose a name for your bot as well as an @username that ends with ‘bot’

2. The botfather will gift you a secret token. Store it in a safe location, as we’ll need it soon!

3. Now we’ll need to create your bot’s brain. For complex bots (and especially if you really want a smart bot), I would advise using languages with strong machine learning libraries, such as Java or Python. But our bot is very simple, and I don’t want you to get lost in the code, so we’ll just make a small Javascript on Node brain and host it on Webtask. 
Webtask is a Cloud service that lets you serve code without having to maintain any server or lose yourself in the intricacies of hosting. It also has an online code editor, which will allow us to create and edit the bot without even leaving our browser!

4.Now surf to Webtask and either create an account, or login with Facebook, Google or Github. It’s free! After logging in, you should either see a ‘try it now’ button. Click it (or just follow this link) to get to the code editor!

5. You should see a prompt like this

Click on ‘create new Webtask’ and name it bot-brains.

6. Now, here’s the brain:

Just copy and paste the code in the Webtask editor. The main thing you should care about at this point is replacing the variable ‘token’ on line 3 with the token you got from Botfather in step 2. After you’re done, save your code by clicking on the hard disk icon, and store the Webtask link (found on the bottom left of the editor) somewhere safe.

copy-paste the run.webtask.io link on the bottom left by clicking on the blue 📃 icon!

7. Last step! We need to tell Telegram where our bot’s brain is located! To do this, we’ll just post a request (basically a short message) to the Telegram bot API using cURL. Just open the command prompt (or the Terminal if you’re on Mac or Linux), take the following command and paste it in the command prompt:

Replace my_url with the webtask link you got from the Webtask editor in step 6, and the XXXXX:tokentoken with the token the Botfather gave you in step 2! Just press enter to send the request — if all went well, Telegram should reply with this:

8. And we’re done! Just head to telegram (t.me/yourbotusername) to see your bot in action!

Part 3: finishing touches

The sheer difference in business models, the constant struggle with both the environment and the competition we’re operating against, as well as the technological and technical issues, make Africa the most hostile environment I’ve ever worked in. Yet, of all the problems I have encountered working in Tanzania, I chose to concentrate on a pretty trivial issue — that of office lunches being shit — and to highlight a solution that, while being interesting and fun to implement, will not win any peace Nobel prize any time soon.

Why?

The answer is twofold. First of all, I do not feel confident (yet) to speak at large about the economic and social problems that this country is facing (problems that, given our main business of selling electricity, our large database of customers and my unique position as the head statistics guy at the company, are becoming more and more painfully obvious every single day). 
I do not feel like I have managed to propose any kind of comprehensive solution yet that would really solve any of the issues we’re seeing. That’s why it would be silly for me to write a grandiose piece about ‘how I fix stuff in Africa’ when the reality is I’m still struggling every day to even understand the place we’re in. The lunch issue was a small, concrete one that I could crack with a moderate investment of time and money; and for the kind of volatile environment I’m operating in now, this is a huge milestone.

The second reason is that I increasingly subscribe to the idea that it’s the small things, the blips in the sea of data, that really make or break this modern life of ours. Being able to sit down at the end of a productive working day, pop open a cold beer and program some silly FoodBingoBot for the sake of it is the ultimate indicator of happiness and safety. Being able to do this kind of stuff is the single biggest difference I’m seeing between here in Africa and home in Europe. We can do pointless things just because we want to; and that’s a luxury we too often take for granted.

And that’s the final point I really want to make. Looking in from Europe or the US we often concentrate on big pictures and large impacts, and tend to forget about the nuances and intricate complexities of this place. But the issues I’m seeing here can’t be solved by manifactured plans, randomized controlled trials, businesses-in-a-container, prayers, or goodwill anymore than they can be solved by good old FoodBingoBot. It will take years and it will take money and it will take a completely different approach than what we’ve been doing so far.

But at some point in the next few years, some young Tanzanian guy or gal will get home from his or her office, think ‘holy crap, the food is awful — what can I do to fix this?’, prop open a laptop and make a bot, or start an online community, or whip out pen and paper, make manifestos and posters, record a song, make a video, diss the boss, publish an online article, roast some colleagues, form a committee, use some of his or her money to pay for takeaway food, cook his or her own food, create a catering business, ask for a small business loan, open a restaurant, close a restaurant, lose a restaurant, fail, get up, run harder, program things, cook things, sing things, make things. 
Not because he needs to, but because he wants to.

That’s when we start winning this war.

Until that day, you can chat with BingoFoodBot at t.me/fedefoodbot :)


“Because we want to — on chatbots, office lunches and doing business in Eastern Africa”, written by Fede Torri for wethepeople research
Views expressed are my own and do not reflect those of my employer(s).