OmanSMSGateway 1.0.0

dotnet add package OmanSMSGateway --version 1.0.0
NuGet\Install-Package OmanSMSGateway -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="OmanSMSGateway" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OmanSMSGateway --version 1.0.0
#r "nuget: OmanSMSGateway, 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.
// Install OmanSMSGateway as a Cake Addin
#addin nuget:?package=OmanSMSGateway&version=1.0.0

// Install OmanSMSGateway as a Cake Tool
#tool nuget:?package=OmanSMSGateway&version=1.0.0

SDK for Oman and Omani SMS Gateways

The purpose of this SDK is to help the developers easily integrate SMS service in their .NET projects. Currently SMS service providers share documentation which has the endpoints in terms of APIs and fresh developers struggle for integration.

For current release, it supports iSmart SMS from Infocom. Additional gateways will be added subsequently by the maintainer and community support is appreciated as well.

Installation

The service for a provided SMS gateway is injected in the Startup class for .NET Core project as follows:

public void ConfigureServices(IServiceCollection services)
{
    // iSmart SMS service registration
    services.AddiSmartSMSService(
            new SMSCredentials()
            {
                Header = "<shared_by_sms_service_provider>",
                UserId = "<shared_by_sms_service_provider>",
                Password = "<shared_by_sms_service_provider>"
            }
        );

    //Other services
}

Usage

In the project, you may inject it in your service or controller class as follows:

[Route("api/[controller]")]
[ApiController]
public class SMSController : ControllerBase
{
    private readonly ISMSHandler _smsHandler;

    public SMSController(ISMSHandler smsHandler)
    {
        _smsHandler = smsHandler;
    }
}

In your method, you can call SendSMSAsync as follows:

It takes message as string, mobileNumbers as List<string> and a bool for checking if it is in Arabic or not.

[HttpPost]
public async Task<ActionResult> SendSMS([FromQuery] string message, [FromQuery] string mobileNumbers, [FromQuery] bool isArabic)
{
    var response = await _smsHandler
                            .SendSMSAsync( 
                                new SMSRequest(
                                    message, 
                                    new List<string>()
                                    {
                                        mobileNumbers
                                    }, 
                                    isArabic ? Language.Arabic : Language.English
                                )
                            );

    if (response.Success)
        return Ok(response);

    return BadRequest(response);
}

Message Length per Language

English Messages:

  • English 1 Part Message = 160 characters
  • English 2 Part Message = 306 characters
  • English 3 Part Message = 459 characters
  • English 4 Part Message = 612 characters
  • English 5 Part Message = 765 characters

Arabic Messages:

  • Arabic 1 Part Message = 70 characters
  • Arabic 2 Part Message = 134 characters
  • Arabic 3 Part Message = 201 characters
  • Arabic 4 Part Message = 268 characters
  • Arabic 5 Part Message = 335 characters
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 226 3/29/2022