Providing AI-powered mental health support services to students in Kenya

4 min readFeb 10, 2022


A collaboration between Zindi, Mtoto News, Basic Needs Basic Rights Kenya, and Qhala has created a chatbot powered by machine learning that serves as a mental health companion for young people in Kenya, specifically university students. This is the first time that machine learning and data science are being used in this way to support those with mental health challenges in Africa.

Crowdsourcing an AI solution

In 2019, the Basic Needs Basic Right Kenya hosted a challenge in collaboration with Zindi called Tech4MentalHealth, with a grand prize of $4200 for the top three positions. The challenge sought to create an app-based solution for the growing mental health struggles of the youth across the country.

“The team at BNBR and Mtoto News had collected a text-based dataset with certain key phrases that described states of mental healthsays Nicholas Loki, the CTO & co-founder of Qhala. “They wanted to get the best natural language processing (NLP) AI model to help categorise if a potential user was suicidal, depressed, addicted to drugs, or suffered from alcoholism.”

BNBR and Mtoto News hosted another competition with Zindi in the same year — the Mtoto News Childline Kenya Call Volume Prediction Challenge. The winner of that challenge was Kenyan data scientist and Zindi Ambassador Lawrence Moruye. Following his first win on the platform, Zindi connected Lawrence with an internship opportunity at Qhala where they worked together to put the winning Tech4MentalHealth solution into production. At Qhala (a digital technology and software agency that helps companies build software, products and services), the model was integrated into a chatbot; this integration would go on to help figure out what a user’s mental health state was when they interacted with the chatbot.

“The idea of the chatbot was never to create a virtual therapist,” says Loki. “The idea was to provide actionable support to these users, by redirecting them to counselors in their schools who could actually help them overcome whatever the mental health challenge was.”

The chatbot (known as Arif) was launched on a 3-month pilot with BNBR to understand how students interacted with it. Initially, there were thoughts of making it into an independent application or hosting it on WhatsApp. But having considered the cost involved, it was finally decided to use Telegram — an existing platform that was quite straightforward and free to use.

Highlights, challenges, and better days

According to Nicholas, it was an exciting, yet challenging project to work on, as a lot went into developing it.

“One challenge, aside from the privacy concerns, was actually figuring out if the solution we were building was the right solution,” he says.

He recounted the extensive user research across several higher institutions to grasp how mental health challenges affected students. There were a series of interviews with health practitioners, therapists, and counselors alike, to understand how they would respond to certain mental health issues and to fully capture the essence of the support service being developed.

“In a nutshell, we were trying to model the conversation chat flow for the chatbot. Also, in the course of this research and survey, it was interesting to find out that most people were open to the idea of interacting with a chatbot to profile them for mental health support services.”

For Zindi, BNBR and Qhala, the chatbot was a successful project, recording participation across five universities, even without significant marketing for it. The data collected at the point of the evaluation showed that the chatbot was incredibly effective at interpreting user interactions, most of which were categorised as suicidal, and was able to direct the affected individuals to the best choice professionals at their institutions.

With the growing mental illness rate in Kenya and across the world, there is a pressing need for proactive solutions. This is why Qhala is still doing their best to continue developing these solutions using the machine learning model created at Zindi. The idea for future projects is to expand the platform using newly acquired datasets to accommodate local languages like Swahili and Sheng to reach more people, and ultimately, provide chatbot support services to solve more problems in Africa besides issues of mental health.




Zindi hosts the largest community of African data scientists, working to solve the world’s most pressing challenges using machine learning and AI.