Skip to content

2 min read#dotnet#sms#open-source#notifications#south-africa

Why SMS Still Matters

In the age of push notifications and chat apps, SMS might seem like legacy technology. But in South Africa and across the African continent, SMS remains the most reliable channel for reaching customers. Not everyone has a smartphone. Not everyone has consistent internet. But virtually every mobile phone can receive an SMS. Delivery rates for SMS consistently outperform those for email and push notifications.

Whether it is OTP verification, appointment reminders, delivery notifications, or marketing campaigns, programmatic SMS is a core requirement for many South African businesses. SMS Portal is one of the country's leading providers, offering a robust API for sending single and bulk messages with delivery reporting.

Building the ISmsPortalService Wrapper

We followed the same interface-driven pattern used for our payment gateway wrappers. ISmsPortalService defines a clean contract for sending SMS messages. The concrete implementation handles authentication with SMS Portal's API, message construction, and response parsing.

The library targets .NET Standard 2.0. This makes it compatible with .NET Framework 4.6.1 and above, .NET Core, and modern .NET. Installation is a single NuGet command. Registration with the DI container follows the standard IServiceCollection pattern that ASP.NET developers expect.

The core methods cover the essential workflows: sending a single SMS to a specified number, sending bulk messages to a list of recipients, and querying delivery status. Each method returns a strongly typed response object so consumers get full IntelliSense and compile-time safety.

Authentication and Configuration

SMS Portal uses token-based authentication. The wrapper handles the authentication flow transparently. It obtains a token on the first request, caches it for the token's lifetime, and refreshes it automatically when it expires. Consumers never have to think about token management.

Configuration follows the IOptions pattern. You provide your SMS Portal API key and sender ID in appsettings.json or environment variables. The library picks them up through dependency injection. This keeps secrets out of source code and makes it easy to switch between sandbox and production environments.

Real-World Usage

We have deployed ISmsPortalService in several production applications. One common pattern is OTP verification during user registration: the service generates a one-time code, sends it via SMS, and validates the code when the user submits it. Another is appointment reminders for healthcare and service businesses. A background job queries upcoming appointments and dispatches reminders at a configurable interval.

The open-source nature of the library means other South African developers can integrate SMS Portal without writing HTTP plumbing from scratch. The MIT licence ensures there are no restrictions on commercial use. If you are building a .NET application that needs to send SMS in South Africa, ISmsPortalService is a solid foundation to build on.