smsnetbd.Csharp.Client
2.0.2
dotnet add package smsnetbd.Csharp.Client --version 2.0.2
NuGet\Install-Package smsnetbd.Csharp.Client -Version 2.0.2
<PackageReference Include="smsnetbd.Csharp.Client" Version="2.0.2" />
<PackageVersion Include="smsnetbd.Csharp.Client" Version="2.0.2" />
<PackageReference Include="smsnetbd.Csharp.Client" />
paket add smsnetbd.Csharp.Client --version 2.0.2
#r "nuget: smsnetbd.Csharp.Client, 2.0.2"
#:package smsnetbd.Csharp.Client@2.0.2
#addin nuget:?package=smsnetbd.Csharp.Client&version=2.0.2
#tool nuget:?package=smsnetbd.Csharp.Client&version=2.0.2
sms.net.bd NuGet Package Documentation
Overview
The smsnetbd.Csharp.Client package provides a simple and powerful interface to interact with the sms.net.bd API for sending SMS messages, managing campaigns, and monitoring account status.
Installation
Install the package via NuGet Package Manager Console:
NuGet\Install-Package smsnetbd.Csharp.Client
Getting Started
Initialize the SMS Client
Obtain your API key from sms.net.bd API portal and initialize the client:
using sms.net.bd;
// Initialize SMS client with your API key
SMS smsClient = new SMS("your-api-key");
Features & Usage
1. Send SMS
Send a text message to a specified phone number.
string phoneNumber = "01800000000";
string message = "Hello, world!";
// string senderId = "xxxxxxx"; // Optional: Use if you have an approved Sender ID
string response = await smsClient.SendSMS(phoneNumber, message, senderId);
Response:
{
"error": 0,
"msg": "Request successfully submitted",
"data": {
"request_id": 12345
}
}
2. Schedule SMS
Schedule a text message to be sent at a specified future time.
string phoneNumber = "01800000000";
string message = "Hello, world!";
string scheduleTime = "2023-11-01 12:00:00"; // Format: YYYY-MM-DD HH:MM:SS
// string senderId = "xxxxxxx"; // Optional: Use if you have an approved Sender ID
string response = await smsClient.ScheduleSMS(phoneNumber, message, scheduleTime, senderId);
Response:
{
"error": 0,
"msg": "Request successfully submitted"
}
3. Get SMS Delivery Report
Retrieve the delivery status of a sent SMS message.
int requestId = 12345; // Request ID from SendSMS response
string report = await smsClient.GetReport(requestId);
Response:
{
"error": 0,
"msg": "Success",
"data": {
"request_id": 12345,
"request_status": "Complete",
"request_charge": "0.2500",
"recipients": [
{
"number": "01800000000",
"charge": "0.2500",
"status": "Sent"
}
]
}
}
4. Get Account Balance
Check your current SMS account balance.
string balance = await smsClient.GetBalance();
Response:
{
"error": 0,
"msg": "Success",
"data": {
"balance": "150.5000"
}
}
5. Get All Approved Campaign Content (New in v2.0.0)
Retrieve a list of all approved campaign content from your account.
string campaigns = await smsClient.GetCampaigns();
Console.WriteLine(campaigns);
6. Send Campaign SMS (New in v2.0.0)
Send an SMS using pre-approved campaign content by content ID.
string phoneNumber = "01800000000";
string contentId = "XXXXX"; // ID of approved campaign content
string response = await smsClient.CampaignSMS(phoneNumber, contentId);
Console.WriteLine(response);
Error Codes Reference
Common Errors
| Error Code | Description |
|---|---|
| 0 | Success - Everything worked as expected |
| 400 | Bad Request - Missing or invalid parameter |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Requested resource doesn't exist |
| 405 | Unauthorized - Authorization required |
| 409 | Server Error - Unknown error on server |
SMS-Specific Errors
| Error Code | Description |
|---|---|
| 410 | Account expired |
| 411 | Reseller account expired or suspended |
| 412 | Invalid schedule time format |
| 413 | Invalid or unapproved Sender ID |
| 414 | Message content is empty |
| 415 | Message exceeds maximum length |
| 416 | No valid recipient number found |
| 417 | Insufficient account balance |
| 418 | Content blocked by filter |
Platform Compatibility
The package supports .NET Standard 2.0, ensuring compatibility with:
- .NET Framework 4.6.1+
- .NET Core 2.0+
- .NET 5, 6, 7, 8+
- Xamarin.iOS 10.14+
- Xamarin.Android 8.0+
- Mono, UWP, and more
Resources
- API Documentation: https://www.sms.net.bd/api
- NuGet Package: https://www.nuget.org/packages/smsnetbd.Csharp.Client
- GitHub Repository: https://github.com/smsnetbd/sms-net-bd-csharp-nuget
Support & Feedback
We value your feedback! If you encounter any issues or have suggestions:
- Contact our support team
- Open an issue on GitHub
- Star us on GitHub if you find this package helpful!
Thank you for using sms.net.bd!
| 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. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 8.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# SMS.Net.Bd NuGet Package Release Note
## New Update smsnetbd.Csharp.Client v2.0.0
We are excited to announce the release of version 2.0.0 of the `smsnetbd.Csharp.Client` NuGet package! This update introduces several significant enhancements and new features to streamline your SMS campaign management and broaden platform support.
## New Features
### 1. Supports a wide range of .NET platform compatibility
To ensure compatibility across all .NET platforms, we've added support for .NET Standard 2.0. This enhancement allows developers to integrate the `SMSNetBD.CSharp.Client` package into a wide range of .NET applications, including those targeting .NET Framework, .NET Core, Xamarin, and more.
### 2. Get All Approved Campaign Content List
We have introduced a new method that allows you to retrieve a list of all approved campaign content available in your account. This feature enables you to easily manage and review the content before initiating any SMS campaigns.
### 3. Send SMS Campaign Content via sms.net.bd API
The latest update also includes a method to send SMS campaign content directly through the sms.net.bd API. This method leverages the campaign content ID to ensure accurate and targeted messaging to your audience.
## How to Use the New Features
### 1. Initializing the SMS Service
To begin, initialize the `SMS` service with your API key:
```csharp
// Initialize SMS client with your API key
SMS smsClient = new SMS("your-api-key");
```
### 2. Get All Approved Campaign Content List
You can now retrieve the list of all approved campaign content by calling the `GetCampaigns` method. This method sends a GET request to the API and returns a list of campaign content in JSON format.
```csharp
string campaigns = await smsClient.GetCampaigns();
Console.WriteLine(campaigns);
```
### 3. Send SMS Campaign Content
To send an SMS campaign using one of the approved contents, use the `CampaignSMS` method. This method finds the campaign content by its ID and sends the corresponding SMS to the specified phone number.
```csharp
string phoneNumber = "01XXXXXXXXX";
string contentId = "XXXXX"; // ID of the approved campaign content
string response = await smsClient.CampaignSMS(phoneNumber, contentId);
Console.WriteLine(response);
```
We appreciate your continued [support and feedback](https://github.com/smsnetbd/sms-net-bd-csharp-nuget). If you have any questions or encounter any issues, please do not hesitate to contact our support team.
## Version 1.1.0
### Summary:
The SMS.Net.Bd NuGet package provides a simple interface to send SMS messages using the SMS.Net.Bd API. This release introduces initial support for sending SMS messages, scheduling SMS messages, checking SMS delivery reports, and retrieving account balance.
### Initialization:
To start using the SMS.Net.Bd NuGet package, follow these steps:
1. **Initialize SMS Client**: Create an instance of the `SMS` class by providing your API key. This API key can be obtained from the [SMS.Net.Bd API website](https://www.sms.net.bd/api).
```csharp
using SMS.Net.Bd;
// Initialize SMS client with your API key
SMS smsClient = new SMS("Your-API-Key");
```
### Usage:
After initializing the SMS client, you can use its methods to interact with the SMS.Net.Bd API. Below are the available methods and their usage:
1. **SendSMS**: Send a text message to a specified phone number.
```csharp
// Send SMS message
string phoneNumber = "1234567890";
string message = "Hello, world!";
string response = await smsClient.SendSMS(phoneNumber, message);
```
2. **ScheduleSMS**: Schedule a text message to be sent at a specified time.
```csharp
// Schedule SMS message
string phoneNumber = "1234567890";
string message = "Hello, world!";
string scheduleTime = "2023-11-01T12:00:00"; // Specify the scheduled time in ISO 8601 format
string response = await smsClient.ScheduleSMS(phoneNumber, message, scheduleTime);
```
3. **GetReport**: Retrieve the delivery report of an SMS message.
```csharp
// Get SMS delivery report
int messageId = 12345; // Specify the ID of the SMS message
string report = await smsClient.GetReport(messageId);
```
4. **GetBalance**: Retrieve the current account balance.
```csharp
// Get account balance
string balance = await smsClient.GetBalance();
```
### Feedback and Support
We welcome your feedback and suggestions for improving the SMS.Net.Bd NuGet package. If you encounter any issues or have questions, please contact [Your Contact Information] or open an issue on the GitHub repository.
Thank you for using SMS.Net.Bd!
For more details on the SMS.Net.Bd API and its usage, refer to the [official API documentation](https://www.sms.net.bd/api).