This is a C# SDK for Infobip API and you can use it as a dependency to add Infobip APIs features to your application. To use this, you'll need an Infobip account. If you do not own one, you can create a free account here.
For Infobip API C# SDK versioning we use Semantic Versioning scheme.
This library is targeting .NET Standard 2.0. When a library is built against a certain version of .NET Standard, it can run on any .NET implementation that implements that version of .NET Standard (or higher)
Published under MIT License.
To start using the Infobip API C# SDK library add it as dependency to your project. You should install Infobip API C# SDK:
Install-Package Infobip.Api.SDK
Or via the .NET Core command line interface:
dotnet add package Infobip.Api.SDK
Either commands, from Package Manager Console or .NET Core CLI, will download and install Infobip API C# SDK and all required dependencies.
Call example used to send WhatsApp text message
public async Task<WhatsAppSingleMessageInfoResponse> SendWhatsAppTextMessage()
{
var configuration = new ApiClientConfiguration(
"https://XYZ.api.infobip.com",
"YOUR_API_KEY_FROM_PORTAL");
var client = new InfobipApiClient(configuration);
var request = new WhatsAppTextMessageRequest
{
From = "FROM_NUMBER",
To = "TO_NUMBER",
MessageId = "MESSAGE_ID",
Content = new WhatsAppTextContent("Message Text!")
};
return await client.WhatsApp.SendWhatsAppTextMessage(request);
}
There are several exceptions defined and they can be thrown by InfobipApiClient class, if some error occurs when calling an API endpoint:
- InfobipException - Occurs during api endpoint call execution in case of general error.
- InfobipRequestNotValidException - Occurs during api endpoint call execution when request model is not valid.
- InfobipBadRequestException - Occurs during api endpoint call execution when http response status code is BadRequest (400).
- InfobipUnauthorizedException - Occurs during api endpoint call execution when http response status code is Unauthorized (401).
- InfobipForbiddenException - Represents errors that occurs during api endpoint call execution in case when http response status code is Forbidden (403).
- InfobipNotFoundException - Represents errors that occurs during api endpoint call execution in case when http response status code is NotFound (404).
- InfobipTooManyRequestsException - Represents errors that occurs during api endpoint call execution in case when http response status code is TooManyRequests (429).
Infobip API Documentation can be found here.
Feel free to participate in this open source project by following the standard fork -> clone -> edit -> pull request workflow!
For running Tests you can use Visual Studio or your favorite console.
To run them from console, just change working directory to src directory, and run following command.
dotnet test