ujumbe-sms-sdk 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ujumbe-sms-sdk --version 1.0.0                
NuGet\Install-Package ujumbe-sms-sdk -Version 1.0.0                
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="ujumbe-sms-sdk" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ujumbe-sms-sdk --version 1.0.0                
#r "nuget: ujumbe-sms-sdk, 1.0.0"                
#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.
// Install ujumbe-sms-sdk as a Cake Addin
#addin nuget:?package=ujumbe-sms-sdk&version=1.0.0

// Install ujumbe-sms-sdk as a Cake Tool
#tool nuget:?package=ujumbe-sms-sdk&version=1.0.0                

Ujumbe SMS SDK

The Ujumbe SMS SDK provides a convenient interface for .Net developers to easily send SMS messages using the Ujumbe SMS API. It is built in C# and handles all of the work required to dispatch SMS and only requires you provide the recipients, the message and your API key

Features

  • Easy to use.
  • Send single or multiple SMS messages using the Ujumbe SMS API.
  • Specify authorization details for accessing the API.
  • Optional callback function to handle the raw HTTP response.
  • Prepend country code to phone numbers (optional).
  • Validation of inputs
  • Error handling with descriptive error information messages
  • Well documented and includes concise examples

Installation

You can install the UjumbeMessenger package via the NuGet Package Manager or by using the dotnet CLI.

Package Manager

PM> Install-Package ujumbe-sms-sdk

.NET CLI

dotnet add package ujumbe-sms-sdk

Usage

To use the UjumbeMessenger package, follow the steps below:

  1. import the UjumbeSmsSdk namespace into your code

    using UjumbeSmsSdk;
    
  2. Send single message

// Create a MessageBag object with the message details
var messageBag = new MessageBag
{
    PhoneNumbers = new HashSet<string> { "+1234567890" }, // Replace with the recipient's phone number(s)
    Message = "Hello, world!", // Replace with your desired message content
    SenderId = "YourSenderID" // Replace with your desired sender ID
};

// Create an Authorization object with the necessary credentials
var authorization = new Authorization
{
    ApiKey = "your-api-key", // Replace with your Ujumbe SMS API key
    YourEmail = "your-email@example.com" // Replace with your email associated with the API key
};

// Initialize an instance of Messenger
var messenger = new Messenger();

try
{
    // Send the single message
    UjumbeResponse response = await messenger.SendSingleMessageAsync(messageBag, authorization);

    // Handle the response
    if (response.Success)
    {
        Console.WriteLine("Message sent successfully!");
    }
    else
    {
        Console.WriteLine("Failed to send the message.");
    }
}
catch (Exception ex)
{
    Console.WriteLine("An error occurred while sending the message.");
    Console.WriteLine($"Error: {ex.Message}");
}

  1. Send Multiple Messages
// Create a list of MessageBag objects with the message details
List<MessageBag> messageBags = new List<MessageBag>
{
    new MessageBag
    {
        PhoneNumbers = new HashSet<string> { "+1234567890" }, // Replace with the recipient's phone number(s)
        Message = "Hello, world!", // Replace with your desired message content
        SenderId = "YourSenderID" // Replace with your desired sender ID
    },
    new MessageBag
    {
        PhoneNumbers = new HashSet<string> { "+9876543210" }, // Replace with the recipient's phone number(s)
        Message = "This is another message.", // Replace with your desired message content
        SenderId = "YourSenderID" // Replace with your desired sender ID
    }
};

// Create an Authorization object with the necessary credentials
Authorization authorization = new Authorization
{
    ApiKey = "your-api-key", // Replace with your Ujumbe SMS API key
    YourEmail = "your-email@example.com" // Replace with your email associated with the API key
};

// Initialize an instance of Messenger
var messenger = new Messenger();

try
{
    // Send the multiple messages
    UjumbeResponse response = await messenger.SendMultipleMessagesAsync(messageBags, authorization);

    // Handle the response
    if (response.Success)
    {
        Console.WriteLine("Messages sent successfully!");
    }
    else
    {
        Console.WriteLine("Failed to send the messages.");
    }
}
catch (Exception ex)
{
    Console.WriteLine("An error occurred while sending the messages.");
    Console.WriteLine($"Error: {ex.Message}");
}

API Reference

Api Reference

License

This project is licensed under the [MIT License] (https://opensource.org/license/mit/).

Contributions

Contributions to this project are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

Disclaimer

This package is not officially affiliated with Ujumbe SMS, but is built based on their REST API specs to ease coding in .Net

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 94 6/9/2024
1.0.0 151 6/9/2023