
While smartphone adoption across Africa continues to grow, USSD (Unstructured Supplementary Service Data) remains the cornerstone of digital financial inclusion. USSD sessions operate offline, work on basic feature phones, and provide immediate transactional responses.
In this guide, we analyze why USSD dominates the fintech landscape and write code to configure an interactive menu.
---
USSD owes its dominance to three fundamental properties:
---
When a user dials a USSD short code (e.g., *384#), the carrier contacts your gateway, which translates the request into an HTTP callback.
Here is a Node.js route handler showing how to manage a basic USSD banking menu:
import express from 'express';
const app = express();app.post('/ussd', (req, res) => { // Read parameters sent from the telecom gateway const { sessionId, serviceCode, phoneNumber, text } = req.body;
let response = '';
if (text === '') {
// This is the first request. Welcome user and print main menu.
response = `CON Welcome to Sendexa Mobile Banking
1. Check Balance
2. Transfer Funds
3. My Account`;
} else if (text === '1') {
// User pressed 1. Display balance.
response = END Your wallet balance is GHS 1,500.00;
} else if (text === '2') {
// User pressed 2. Request transfer details.
response = CON Enter recipient phone number:;
} else if (text.startsWith('2*')) {
// User entered transfer details (e.g., '2*08012345678')
const parts = text.split('*');
const recipient = parts[1];
response = END GHS 500.00 has been sent to ${recipient};
} else {
// Invalid selection
response = END Invalid input. Please try again.;
}
// Set the correct USSD response headers res.set('Content-Type', 'text/plain'); res.status(200).send(response); });
app.listen(3000, () => console.log('USSD service active on port 3000'));
`
---
*With Sendexa's USSD API, developers can instantly buy virtual short codes and host interactive, session-managed menus with sub-second response times.*
Founder & Lead Developer at Sendexa, writing about high-throughput communication APIs, security, and digital inclusion.