Step by step guide to creating a USSD application.
Create a USSD application with Africa’s Talking and Heroku.

This blog post will serve as a guide to help you create a USSD application. USSD stands for Unstructured Supplementary Service Data, which is a communication protocol that uses the GSM network for sending short text messages. This simple technology created in 1994, has had a tremendous effect on how transactions are being made in Africa. With USSD services such M-Pesa generating revenue of about 765.12 Billion USD in 2021 alone with other services like MTN Moblie Money not far behind.
In this blog tutorial, we will explore how to create a simple USSD session, that simulates how MTN’s MoMo USSD session works. This project will be coded using Flask and deployment will be done by using Ngrok with the USSD session being created and managed by Africastalking.com.
Architecture.

Project Code
I have written, code for a sample USSD application, that simulates, the MTN short-code for buying Airtime and Data Bundles. This code can be found on in this GitHub repository. To get the code for this program, run the following git command.
git clone https://github.com/SedemQuame/fido-ussd-app.git
The project code can be run by using the flask run
command, to start up the server, in a development environment which will start up the server in default port 5000, you can access this link by following http://127.0.0.1:5000/
To test this project, you will need to install ngrok, to expose the application on the development server, to internet. This can be done by following the following steps.
- Install ngrok, from https://ngrok.com/download
- Expose the running flask application using ngrok, by running the following command
ngrok http 5000
. - Copy the resulting URL, which will be used in the next steps.
Setting up the project on Africas Talking Platform.
Start by creating an account on africastalking.com, which is a website that will be used to generate shared USSD codes, map URL endpoints to the generated USSD codes and manage USSD sessions between multiple user sessions.
After creating the account, the next thing to do is to determine the USSD codes that we want to use for our application, this illustrated below.

Creating a new channel.

A new USSD channel can be created by filling the above form, in the USSD tab of Africa’s Talking. Below are the following steps to take, when creating the USSD channel.
- Select a shared service code (if using the free plan), or select the dedicated shared service code.
- Select the channel.
- Enter the url, given to you by Africa’s Talking.
Testing Testing.
To start testing the USSD code, click on the Launch Simulator from the left part of the Pane. This opens up a new sandboxed page, where you enter your phone number and submit to get access to the simulator page, click the USSD option. This opens up the USSD session.

Enter the USSD service code, in the input field below.

Clicking the call button will call the URL endpoint which returns the USSD menu.

Conclusion
In conclusion, this step-by-step guide has walked you through the process of creating a USSD application using Africa’s Talking and Heroku. USSD technology has played a significant role in transforming the way transactions are conducted in Africa, with services like M-Pesa and MTN Mobile Money generating substantial revenue. By following this tutorial, you’ve gained the knowledge and skills to develop your own USSD applications, potentially opening up new opportunities in the rapidly evolving tech landscape of Africa.
We started by providing an overview of USSD and its impact, highlighting the immense financial success of USSD-based services. Then, we delved into the architecture of the USSD application and shared the project code available on GitHub for your reference.
To test the application locally, you learned how to use ngrok to expose your development server to the internet, making it accessible for testing.
Next, we guided you through the setup process on Africa’s Talking platform, where you can create shared USSD codes, map URL endpoints, and manage USSD sessions efficiently. We covered the steps to create a new USSD channel, choose service codes, and integrate your application with Africa’s Talking.
Lastly, we emphasized the importance of testing your USSD code using the simulator provided by Africa’s Talking. This step ensures that your USSD application functions correctly and delivers the expected USSD menus.
By following these steps and leveraging the power of USSD technology, you are well-equipped to embark on your journey of developing innovative and impactful applications tailored to the African market. USSD has already proven its potential, and with your creativity and expertise, you can contribute to its continued growth and evolution in the region. Good luck with your USSD development endeavors!