This USSD (Unstructured Supplementary Service Data) App is a Flask-based application designed to interact with Africa's Talking servers. It provides a simple interface for users to check their account information and phone number through a USSD menu system.
- Interactive USSD menu system
- Account information retrieval
- Phone number display
- Integration with Africa's Talking API
Create an Africa's Talking account or sign into your account. Head over to the Sandbox section and get your API key to make sure that your app can be authenticated by the servers.
-
Clone the repository (if you haven't already):
git clone https://github.com/bryokn/USSD.gitcd USSD -
Create and activate a virtual environment:
python3 -m venv venvsource venv/bin/activate# On Windows, usevenv\Scripts\activate
Download the python file to your project folder. Install flask making sure all the dependencies are fulfilled
pip install flask
OR (depending on how your Python installation works)
pip3 install flask
Once done, run the file with
(Ensure your virtual environment is activated.)
python3 app.py
OR (depending on your python installation)
python app.py
The server should be up and running after that.
Download and install ngrok
Head over to where you have installed ngrok and run:
./ngrok http 5000
Ngrok will provide a public URL (e.g., https://abcd1234.ngrok.io) that you can use to access your app.
NOTE: The free version of ngrok will generate a new URL each time you restart it. For a consistent URL, consider upgrading to a paid plan.
This is the workflow for Unix based systems (Linux and MacOS) I'll add something for Windows later. Or check ngrok docs. That maps the localhost to a live link hosted by ngrok.
-
Log in to your Africa's Talking account.
-
Navigate to the Sandbox section.
-
Create a new USSD channel:
- Set the channel name
- Enter the ngrok URL as the callback URL
- Choose POST as the HTTP method
-
Once created, you'll receive a USSD code for testing.
-
Use the Africa's Talking simulator or a real device to test your USSD application.
If you encounter any issues:
- Ensure all dependencies are correctly installed.
- Verify that the ngrok URL is correctly set as the callback URL in your Africa's Talking USSD channel.
- Check the Flask server logs for any error messages.
If you have any problems, raise and issue here and I will be sure to help out!