USSD Banking Application Starter Angola.
# USSD Banking Demo (Africa's Talking)
This small demo provides a USSD backend you can use to test against Africa's Talking USSD callbacks.
Getting started
1. Install dependencies
```bash
npm install
```
2. Run the server
```bash
npm start
```
3. Expose it to the internet for Africa's Talking (use `ngrok`)
```bash
ngrok http 3000
```
Configure your Africa's Talking USSD callback to point to `https:// /ussd` (POST).
Automated ngrok + test (PowerShell)
If you're on Windows and have `ngrok` installed, there's a PowerShell helper that starts `ngrok`, starts the server in a new window, waits for ngrok to report a public URL, and runs the automated USSD test script against it.
Run:
```powershell
powershell -ExecutionPolicy Bypass -File .\scripts\run-with-ngrok.ps1
```
Notes about the helper:
- Requires `ngrok` and `npm` in your PATH.
- The helper reads the ngrok API at `
127.0.0.1` to discover the public URL.
- The test script uses the discovered URL to target the `/ussd` endpoint.
Testing locally with curl
Africa's Talking sends `application/x-www-form-urlencoded` POSTs. Example below simulates a session start:
```bash
curl -X POST
localhost \
-d "sessionId=12345" \
-d "serviceCode=*123#" \
-d "phoneNumber=+254700000000" \
-d "text="
```
To simulate entering `1` then a PIN (e.g. `1234`):
```bash
curl -X POST
localhost \
-d "sessionId=12345" \
-d "serviceCode=*123#" \
-d "phoneNumber=+254700000000" \
-d "text=1*1234"
```
Notes
- This is a demo server with in-memory data. Restarting the server resets accounts.
- Default PIN for newly created demo accounts is `1234` and the starting balance is `KES 1000.00`.
- For production use, replace the in-memory store with a database and secure PIN handling.
# USSD Banking Starter