This a Rest API Client Library based on the Official API Documentation provided by Jusibe, a Nigerian SMS Service.
dotnet add package Jusibe
- First, in your
appsettings.json
file, create a new section for Jusibe.
"Jusibe": {
"Key": "Your API Key here",
"Token": "You can get both the Key and Token from your Jusibe Dashboard",
"BaseAddress" : "Jusibe Base Address. (It's probably 'https://jusibe.com/smsapi')"
}
- Add this snippet to your ConfigureServices method in your Startup.cs file:
using Jusibe;
public void ConfigureServices(IServiceCollection services)
{
// other services ommitted for brevity
services.AddJusibeClient(Configuration);
}
And then the client can be added wherever it is needed via Dependency Injection:
public class SmsService
{
private readonly IJusibeClient _jusibeClient;
public SmsService(IJusibeClient jusibeClient)
{
_jusibeClient = jusibeClient;
}
...
// Rest of your code here...
}
using Jusibe;
var jusibeClient = new JusibeClient(new JusibeClientOptions
{
Key = "Your Jusibe Key Here",
Token = "Your Jusibe Token Here",
BaseAddress = "https://jusibe.com/smsapi"
});
With this Jusibe Client, you can ...
ResponseModel result = await jusibeClient.SendSms(new RequestModel() {
From = "mykeels",
To = "08012345678",
Message = "Hello World"
});
CreditModel result = await client.GetCredits();
This gives you information on the delivery status of previous sent messages.
DeliveryStatusModel result = await client.GetDeliveryStatus("message_id");
Lets you send Bulk sms:
BulkResponseModel result = await client.SendBulkSms(new BulkRequestModel() {
From = "mykeels",
To = "08012345678,08012345678", // phone numbers separated by commas
Message = "Hello World"
});
This gives you information on the delivery status of previous sent bulk message.
BulkStatusResponseModel result = await client.GetBulkSmsStatus("bulk_message_id");
You are free to fork this repo and make pull requests to enhance the functionalities of this library.
- Follow @mykeels on twitter
- Star this github repo
- Check out my other projects and see if you like them
- Provide useful critism. I would love to hear from you, really
Thanks, Ikechi Michael I.
PS. @allengblack made some significant updates to this. Follow him on Twitter, too!
The MIT License (MIT). Please see License File for more information.