GhasedakSms.Framework is a .NET Framework library designed to interact with the Ghasedak SMS API, allowing you to send SMS, check statuses, and manage SMS-related functionalities efficiently.
- Send SMS: Supports sending single, bulk, and pair-to-pair SMS.
- OTP Management: Easily send OTP messages with customizable parameters.
- Receive SMS: Retrieve received messages with pagination support.
- Account Information: Fetch account details like balance and other information.
Install the package via NuGet Package Manager:
dotnet add package GhasedakSms.Framework
Or using the NuGet Package Manager Console:
Install-Package GhasedakSms.Framework
To start using the library, initialize the Ghasedak
client with your API key:
var apiKey = "your_api_key";
var client = new Ghasedak(apiKey);
Retrieve account information such as balance:
var accountInfo = await client.GetAccountInformation();
var receivedMessages = await client.GetReceivedSmses(new GetReceivedSmsInput
{
LineNumber = "3000****",
IsRead = true
});
var receivedMessagesPaged = await client.GetReceivedSmsesPaging(new GetReceivedSmsPagingInput
{
LineNumber = "3000****",
IsRead = true,
StartDate = DateTime.Now.AddDays(-7),
EndDate = DateTime.Now,
PageIndex = 1,
PageSize = 10
});
var otpTemplate = await client.GetOtpParameters(new GetOtpParametersInput
{
TemplateName = "Ghasedak"
});
var sendOtp = await client.SendOtpSMS(new SendOtpInput
{
TemplateName = "Ghasedak",
SendDate = DateTime.Now,
Inputs = new List<OtpInput>
{
new OtpInput { Param = "Code", Value = "1234" },
},
Receptors = new List<SendOtpReceptorDto>
{
new SendOtpReceptorDto { ClientReferenceId = "testOtp1", Mobile = "0912*******" },
new SendOtpReceptorDto { ClientReferenceId = "testOtp2", Mobile = "0912*******" }
}
});
The SendOtpWithParams
function allows you to send an OTP message using predetermined parameters.
var sendOtpWithParams = await client.SendOtpWithParams(new SendOtpWithParamsInput
{
TemplateName = "otpTemplate",
Param1 = "value1",
Param2 = "value2",
Param3 = "value3",
Param4 = "value4",
Param5 = "value5",
Param6 = "value6",
Param7 = "value7",
Param8 = "value8",
Param9 = "value9",
Param10 = "value10",
Receptors = new List<SendOtpReceptorDto>
{
new SendOtpReceptorDto { ClientReferenceId = "otpTest1", Mobile = "0912*******" },
new SendOtpReceptorDto { ClientReferenceId = "otpTest1", Mobile = "0912*******" },
},
SendDate = DateTime.Now
});
var sendSingle = await client.SendSingleSMS(new SendSingleSmsInput
{
LineNumber = "3000****",
ClientReferenceId = "testsingle",
Message = "test single",
Receptor = "0912*******",
SendDate = DateTime.Now
});
var sendBulk = await client.SendBulkSMS(new SendBulkInput
{
LineNumber = "3000****",
Message = "test bulk",
Receptors = new List<string> { "0912*******", "0912*******" },
ClientReferenceId = "testbulk",
SendDate = DateTime.Now
});
var sendPair = await client.SendPairToPairSMS(new SendPairToPairInput
{
Items = new List<SendPairToPairSmsWebServiceDto>
{
new SendPairToPairSmsWebServiceDto
{
ClientReferenceId = "testpair",
LineNumber = "3000****",
Message = "test pair to pair",
Receptor = "0912*******",
SendDate = DateTime.Now
}
}
});
var statuses = await client.CheckSmsStatus(new CheckSmsStatusInput
{
Type = MessageIdType.MessageId,
Ids = new List<string> { "12345", "67890" } // Replace with actual Message IDs
});
Contributions are welcome! Feel free to fork the repository, open issues, or submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or support, please reach out to the Ghasedak team at support@ghasedak-ict.com.