Africa’s Talking Node.js (express) USSD Application

The app developed here will help a user to view their phone number and account details (Account number and account balance).Follow this article to set up a simulator.After you have launched the simulator, go back to your sandbox dashboard and create a channel. A channel will help us to run our implementation. A channel will constitute a Service Code and Callback URL.A Service Code is the USSD code that we are going to type on our simulator and it will call the callback url upon hitting send. You can imagine a situation whereby someone is checking their balance. For instance, they will enter *144# and hit send. The *144# is a Service Code. Upon hitting send, a callback URL will be called, the URL endpoint will help to carry out the needed operations which will be to determine the actual calculation of the balance and return the results.How to create a channelUnder the USSD menu in your sandbox dashboard click Create Channel.

USSD application

To create a channel you will need acallback URL. A callback URL will be called when a user sends a request using a service code.Create a callback URL

  • Head to and create an account or login if you have one.
  • Download and unzip ngrok which will help us to access our localhost server through the internet.
  • After downloading the ngrok open a terminal window and navigate to the directory where you downloaded the setup.
explore ngrok setup and installation
  • Copy the command shown in the above screenshot and enter it in the terminal. Note: The above command should be run int the directory where you downloaded the ngrok
programming script
  • Run ./ngrok HTTP 3000 to start an HTTP tunnel to our localhost on port 3000. You will be able to see something like shown below.
ngrok by inconshreveable status online
  • Copy the Forwarding URL. For my case it is
  • Paste the link in the callback URL field and input a channel of your choice and if the channel is not available you will get a suggestion as shown in the image below.
USSD application

We should have something as shown below in our USSD — Service Codes.

africas talking ussc code

Now that we have a channel fully configured we can start writing code.

  1. Initialize a node application via yarn init or npm init
  2. Install express, nodemon, body-parser and Africa's Talking dependencies via yarn add express nodemon Africa's Talking body-parser or npm install express Africa's Talking nodemon body-parser -— save
  3. In the root directory (current directory) of the app, create a file named index.js and add the following code into the file.
programming script
  1. Create another file in the root of your project and name it app.js and add the following code into the file.
const express app listen
  1.  Modify your package.json file to include a script to run the app. The file should then look something like below.
package.json ussd-app
  1.  In your root folder via the terminal type yarn start or npm start to start the app.
  2. Head to our simulator and choose the USSD option.
  3. Dial USSD — Service Code in the simulator which we generated earlier. For my case it is *384*77255#
mobile phone
  1. The following screenshots show the results after dialing the USSD code.
smartphone vector art

Feel free to play around with the options provided. This means that our USSD app if fully functional.

Related posts

The latest articles from Andela.

Visit our blog

How to hire a Python developer: A guide to finding the right fit

Figuring out how to hire a Python developer? Our guide covers all you need to know, from defining job requirements to finding the right fit for your team!

Top takeaways from Gartner IT Symposium

As the symposium concluded, it became evident that the journey into the AI-driven future is both challenging and exhilarating for IT leaders.

Android ML face detection with Camera X

In this Writer's Room tutorial, Andela Community member Stephen Henry explains how to integrate ML face detection into an Android app using CameraX.

We have a 96%+
talent match success rate.

The Andela Talent Operating Platform provides transparency to talent profiles and assessment before hiring. AI-driven algorithms match the right talent for the job.