Ntiri.UssdFramework 1.0.0

dotnet add package Ntiri.UssdFramework --version 1.0.0
                    
NuGet\Install-Package Ntiri.UssdFramework -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ntiri.UssdFramework" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ntiri.UssdFramework" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ntiri.UssdFramework" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ntiri.UssdFramework --version 1.0.0
                    
#r "nuget: Ntiri.UssdFramework, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ntiri.UssdFramework@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ntiri.UssdFramework&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ntiri.UssdFramework&version=1.0.0
                    
Install as a Cake Tool

Ntiri USSD Framework

A comprehensive .NET framework for building USSD (Unstructured Supplementary Service Data) applications with support for menus, forms, queries, and booklets.

Features

  • Multi-targeting: Supports .NET Standard 2.0 and .NET 8
  • Menu System: Build interactive USSD menus with pagination
  • Form Processing: Handle user input through structured forms
  • Query Engine: Execute dynamic queries with scripting support
  • Booklet Navigation: Multi-page content display with navigation
  • Data Management: Built-in data bag for session management
  • Redis Support: Distributed caching and session storage
  • Logging Extensions: MongoDB and AWS logging support (separate package)

Installation

Core Framework

# Using .NET CLI
dotnet add package Ntiri.UssdFramework

# Using Package Manager Console
Install-Package Ntiri.UssdFramework

Logging Extensions

# Using .NET CLI
dotnet add package Ntiri.UssdFramework.Logging

# Using Package Manager Console
Install-Package Ntiri.UssdFramework.Logging

PackageReference (add to .csproj)

<PackageReference Include="Ntiri.UssdFramework" Version="1.0.0" />
<PackageReference Include="Ntiri.UssdFramework.Logging" Version="1.0.0" />

Quick Start

1. Configure Default Controller

Create a default controller to handle incoming USSD requests:

using Microsoft.AspNetCore.Mvc;
using Ntiri.UssdFramework;
using Ntiri.UssdFramework.Stores;

[ApiController]
[Route("[controller]")]
public class DefaultController(IConfiguration configuration) : ControllerBase
{
    [HttpPost]
    public async Task<IActionResult> Index(UssdRequest request)
    {
        try
        {
            var redisAddress = configuration.GetSection("Redis:Address").Value;
            var redisDbNumber = configuration.GetSection("Redis:DbNumber").Get<int>();

            var response = await Ussd.Process(
                new RedisStore(redisAddress, redisDbNumber),
                request,
                "Service",
                "HomePage"
            );

            // Log outgoing response
            Console.WriteLine($"Outgoing Response: {System.Text.Json.JsonSerializer.Serialize(response)}");

            return Ok(response);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
            throw;
        }
    }
}

2. Define USSD Menus in Service Controller

Create your USSD service controller with menu definitions:

using Ntiri.UssdFramework;

[Route("api/[controller]")]
[ApiController]
public class ServiceController : UssdController
{
    public ServiceController()
    {
        ReleaseEvent = SignOut;
    }

    public async Task<UssdResponse> HomePage()
    {
        await ServicePrerequisite().ConfigureAwait(false);

        return await RenderMenu(new UssdMenu
        {
            Header = "Welcome to USSD Sample App",
            Items = new List<UssdMenuItem>
            {
                new UssdMenuItem
                {
                    Action = "MakePayment",
                    Display = "Make Payment",
                    Controller = "Service",
                },
                new UssdMenuItem
                {
                    Action = "TicketStatus",
                    Display = "Check Status",
                    Controller = "Service",
                },
                new UssdMenuItem
                {
                    Action = "ContactUs",
                    Display = "Contact Us",
                    Controller = "Service",
                }
            },
        });
    }

    public async Task<UssdResponse> MakePayment()
    {
        // Your payment logic here
        return await RenderMessage("Payment processing...");
    }

    public async Task<UssdResponse> TicketStatus()
    {
        // Your status check logic here
        return await RenderMessage("Checking status...");
    }

    public async Task<UssdResponse> ContactUs()
    {
        // Your contact information logic here
        return await RenderMessage("Contact: support@example.com");
    }

    private async Task ServicePrerequisite()
    {
        // Initialize any required services or data
        await Task.CompletedTask;
    }

    public async Task SignOut()
    {
        // Cleanup logic when session ends
        await Task.CompletedTask;
    }
}

3. Configure Redis (appsettings.json)

{
  "Redis": {
    "Address": "localhost:6379",
    "DbNumber": 0
  }
}

Advanced Features

Form Processing

public async Task<UssdResponse> RegistrationForm()
{
    return await RenderForm(new UssdForm
    {
        Header = "Registration",
        Fields = new List<UssdFormField>
        {
            new UssdFormField { Name = "FullName", Prompt = "Enter your full name:" },
            new UssdFormField { Name = "PhoneNumber", Prompt = "Enter your phone number:" },
            new UssdFormField { Name = "Email", Prompt = "Enter your email:" }
        },
        Action = "ProcessRegistration"
    });
}

Booklet Navigation

public async Task<UssdResponse> HelpBooklet()
{
    return await RenderBooklet(new UssdBooklet
    {
        Pages = new List<string>
        {
            "Page 1: Getting Started\nWelcome to our service...",
            "Page 2: Making Payments\nTo make a payment...",
            "Page 3: Support\nFor support, contact..."
        }
    });
}

Query Execution

public async Task<UssdResponse> AccountBalance()
{
    var query = new UssdQuery
    {
        QueryString = "SELECT Balance FROM Accounts WHERE UserId = @userId",
        Parameters = new Dictionary<string, object> { { "userId", DataBag["UserId"] } }
    };
    
    return await ExecuteQuery(query);
}

Compatibility

Framework Support
.NET Standard 2.0
.NET Core 2.0+
.NET 5+
.NET 6+
.NET 7+
.NET 8+
.NET Framework 4.6.1+

Dependencies

Core Framework

  • Newtonsoft.Json
  • StackExchange.Redis
  • DynamicExpresso.Core
  • Microsoft.Extensions.Logging.Abstractions

Logging Extensions

  • MongoDB.Driver
  • AWSSDK.Core
  • System.Configuration.ConfigurationManager

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Support

For issues, questions, or contributions, please visit our GitHub repository.

Changelog

Version 1.0.0

  • Initial release
  • Multi-targeting support for .NET Standard 2.0 and .NET 8
  • Core USSD functionality: Menus, Forms, Queries, Booklets
  • Redis integration for session management
  • Logging extensions for MongoDB and AWS
References and Acknowledgement
  • Osei Poku Gyamfi
  • Stanpro
  • Samora
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Ntiri.UssdFramework:

Package Downloads
Ntiri.UssdFramework.Logging

Logging extensions for Ntiri USSD Framework with MongoDB and AWS support for comprehensive application logging and monitoring.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 441 10/4/2025

Version 1.4.7: Fixed System.Configuration assembly reference issues for multi-targeting support.