FahdCloud.ThirdParty.SMS
10.0.6
dotnet add package FahdCloud.ThirdParty.SMS --version 10.0.6
NuGet\Install-Package FahdCloud.ThirdParty.SMS -Version 10.0.6
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="FahdCloud.ThirdParty.SMS" Version="10.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FahdCloud.ThirdParty.SMS" Version="10.0.6" />
<PackageReference Include="FahdCloud.ThirdParty.SMS" />
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 FahdCloud.ThirdParty.SMS --version 10.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FahdCloud.ThirdParty.SMS, 10.0.6"
#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 FahdCloud.ThirdParty.SMS@10.0.6
#: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=FahdCloud.ThirdParty.SMS&version=10.0.6
#tool nuget:?package=FahdCloud.ThirdParty.SMS&version=10.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FahdCloud.ThirdParty.SMS
FahdCloud.ThirdParty.SMS provides stateless SMS services for:
SMS MasrTaqnyat SMS
Each call receives provider settings explicitly. Provider base URLs are fixed inside the library.
Installation
dotnet add package FahdCloud.ThirdParty.SMS
Registration
using FahdCloud.ThirdParty.SMS.DependencyInjection;
builder.Services.AddSmsProviders();
Or register a single provider:
builder.Services.AddSmsMasr();
builder.Services.AddTaqnyatSms();
SMS Masr Example
using FahdCloud.ThirdParty.SMS.Abstractions;
using FahdCloud.ThirdParty.SMS.Models;
using FahdCloud.ThirdParty.SMS.Providers.SmsMasr;
public sealed class SmsMasrSender(ISmsMasrService smsMasrService)
{
public Task<SmsSendResponse> SendAsync(CancellationToken cancellationToken)
{
var settings = new SmsMasrSettings
{
Username = "your-user",
Password = "your-password",
SenderToken = "your-sender-token",
Environment = 2
};
var request = new SmsSendRequest
{
To = ["201001234567"],
Message = "Hello from FahdCloud SMS",
Language = SmsMessageLanguage.English
};
return smsMasrService.SendMessageAsync(settings, request, cancellationToken);
}
}
SMS Masr OTP Example
using FahdCloud.ThirdParty.SMS.Providers.SmsMasr;
public sealed class OtpSender(ISmsMasrService smsMasrService)
{
public Task SendAsync(CancellationToken cancellationToken)
{
var settings = new SmsMasrSettings
{
Username = "your-user",
Password = "your-password",
SenderToken = "your-sender-token",
Environment = 2
};
return smsMasrService.SendOtpAsync(settings, new SmsMasrOtpRequest
{
Mobile = "+201001234567",
TemplateToken = "template-token",
Otp = "123456"
}, cancellationToken);
}
}
Taqnyat Example
using FahdCloud.ThirdParty.SMS.Models;
using FahdCloud.ThirdParty.SMS.Providers.Taqnyat;
public sealed class TaqnyatSender(ITaqnyatSmsService taqnyatSmsService)
{
public Task<SmsSendResponse> SendAsync(CancellationToken cancellationToken)
{
var settings = new TaqnyatSmsSettings
{
BearerToken = "your-bearer-token",
DefaultSender = "YourSender"
};
var request = new SmsSendRequest
{
To = ["966500000000"],
Message = "Hello from FahdCloud SMS"
};
return taqnyatSmsService.SendMessageAsync(settings, request, cancellationToken);
}
}
Taqnyat Scheduled Message Example
using FahdCloud.ThirdParty.SMS.Providers.Taqnyat;
public sealed class ScheduledSmsSender(ITaqnyatSmsService taqnyatSmsService)
{
public Task SendAsync(CancellationToken cancellationToken)
{
var settings = new TaqnyatSmsSettings
{
BearerToken = "your-bearer-token",
DefaultSender = "YourSender"
};
return taqnyatSmsService.SendScheduledMessageAsync(settings, new TaqnyatScheduledMessageRequest
{
Recipients = ["966500000000"],
Body = "Scheduled hello",
ScheduledAt = DateTimeOffset.UtcNow.AddHours(1)
}, cancellationToken);
}
}
Provider Operations
SMS Masr
SendMessageAsync(settings, request)SendOtpAsync(settings, request)GetBalanceAsync(settings)
Taqnyat
SendMessageAsync(settings, request)SendScheduledMessageAsync(settings, request)DeleteScheduledMessageAsync(settings, deleteId)GetBalanceAsync(settings)GetSendersAsync(settings)
Notes
- Services are stateless.
- Provider base URLs are internal constants in the library.
- Phone numbers are normalized to international format without
+or leading00. SMS Masrsends multiple recipients as a comma-separatedmobilevalue.Taqnyatsends recipients as a JSON array and authenticates with bearer token.- Refit is used internally for provider API contracts.
Test Project
The test project is a console-based integration harness.
Files:
To use it:
- Fill in provider credentials and test recipients in
tests/FahdCloud.ThirdParty.SMS.Tests/appsettings.json. - Run the test project.
- Choose the provider from the console menu.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Refit.HttpClientFactory (>= 10.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.