PostaGuvercini.NET.SMS
0.0.6
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PostaGuvercini.NET.SMS --version 0.0.6
NuGet\Install-Package PostaGuvercini.NET.SMS -Version 0.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="PostaGuvercini.NET.SMS" Version="0.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PostaGuvercini.NET.SMS" Version="0.0.6" />
<PackageReference Include="PostaGuvercini.NET.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 PostaGuvercini.NET.SMS --version 0.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PostaGuvercini.NET.SMS, 0.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 PostaGuvercini.NET.SMS@0.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=PostaGuvercini.NET.SMS&version=0.0.6
#tool nuget:?package=PostaGuvercini.NET.SMS&version=0.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PostaGuvercini.NET.SMS
A C# library for sending SMS messages using the Posta Guvercini SMS API.
Features
- Send OTP, informational, and advertisement SMS messages
- Personalize messages for each receiver
- Track message delivery status
- Check account credit
- Advanced options: scheduling, expiration, SIM card check, dealer code, and more
- Supports dependency injection
- Asynchronous methods with cancellation support
- Detailed error handling with exceptions
- Supports .NET Standard 2.0 and above
Installation
Install via NuGet:
dotnet add package PostaGuvercini.NET.SMS
Usage
Initialization
using PostaGuvercini.NET.SMS;
var sms = new SMS("API_DOMAIN", "YOUR_PUBLIC_KEY", "YOUR_PRIVATE_KEY");
Or with options:
var sms = new SMS(new SMSOptions {
Domain = "API_DOMAIN",
PublicKey = "YOUR_PUBLIC_KEY",
PrivateKey = "YOUR_PRIVATE_KEY",
Timeout = TimeSpan.FromSeconds(30)
});
Or can be injected via dependency injection:
services.AddSMS(ServiceLifetime.Transient, (provider) =>
new SMSOptions {
Domain = "API_DOMAIN",
PublicKey = "YOUR_PUBLIC_KEY",
PrivateKey = "YOUR_PRIVATE_KEY",
Timeout = TimeSpan.FromSeconds(30)
});
// Later in your code, you can retrieve the ISMS instance or inject it into your classes:
ISMS sms = provider.GetRequiredService<ISMS>();
// Or inject it directly into your class constructor
public class MyController : ControllerBase
{
private readonly ISMS _sms;
public MyController(ISMS sms)
{
_sms = sms;
}
// Use _sms in your actions
}
API Reference
From(senderId)
: Set sender ID (required)Text(text, encoding)
: Set message text and encodingTo(mobileNumber, ...)
: Add receiver(s) (Multiple overloads available)CreditAsync()
: Check account creditStatusAsync(messageId)
: Check delivery status of a messagePurpose(purpose)
: Set message purpose (OTP, INFORMATIONAL, ADVERT)Label(label)
: for tracking and reportingReferenceId(referenceId)
: to set reference ID of message for your internal trackingSendTime(dateTime)
: to schedule messages for future deliveryExpireTime(dateTime)
: to set message validity periodCheckSimCard()
: Enable SIM card change check (OTP only)DealerCode(code)
: Set dealer codeSendAsync()
: Send message (generic), purpose must be set before callingSendOtpAsync()
: Send OTP messageSendInformationalAsync()
: Send informational messageSendAdvertAsync()
: Send advertisement message
Notes
- Sender ID must be pre-registered with the SMS provider.
- OTP messages: max 10 receivers per request.
- Regular messages: max 10,000 receivers per request.
- Personalization is supported using
{{1}}
,{{2}}
, etc. in the text. (Order of the placeholders matters. Must be exactly the same as the number of parameters provided for each receiver.) - All methods are asynchronous and support cancellation tokens.
- Exceptions are thrown for errors; handle them appropriately.
- HTTP Timeout can be configured in
SMSOptions
or by constructor. - For advanced usage, refer to the API documentation of Posta Guvercini.
Examples
Sending a Simple SMS
await sms
.From("SENDERID")
.Text("Hello, this is a test message!")
.To(905555555555)
.SendInformationalAsync();
Sending Personalized OTP SMS
await sms
.From("SENDERID")
.Text("Hello {{1}}, your login code is {{2}}")
.To(905550000000, ["John Doe", "123456"])
.To(905551111111, ["Alex Doe", "567890"])
.SendOtpAsync();
Sending Bulk SMS
await sms
.From("SENDERID")
.Text("This is a bulk message to multiple recipients.")
.Label("My Bulk Message")
.To([ 905550000000,
905551111111,
905552222222 ])
.SendAdvertAsync();
Sending Different Texts to Multiple Receivers
await sms
.From("SENDERID")
.To(905550000000, text: "Hello John, your code is 123456")
.To(905551111111, text: "Hello Alex, your code is 567890")
.SendInformationalAsync();
var receivers = [
new DataMessageReceiver(905550000000, "Hello John, your promotion code is 123456"),
new DataMessageReceiver(905551111111, "Hello Alex, your promotion code is 567890"),
new DataMessageReceiver(905552222222, "Hello Jane, your promotion code is 789012")
];
await sms
.From("SENDERID")
.To(receivers)
.SendAdvertAsync();
Checking Message Status
var status = await sms.StatusAsync("MESSAGE_ID");
Checking Credit
var credit = await sms.CreditAsync();
For more information, contact Posta Guvercini support.
Product | Versions 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 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. 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.
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- System.Text.Json (>= 9.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.