{"id":19337254,"url":"https://github.com/infobip/infobip-api-csharp-client","last_synced_at":"2025-07-30T03:33:36.307Z","repository":{"id":30305959,"uuid":"108974770","full_name":"infobip/infobip-api-csharp-client","owner":"infobip","description":"Infobip API client library in C#, distributed as a NuGet package.","archived":false,"fork":false,"pushed_at":"2025-03-03T14:50:42.000Z","size":777,"stargazers_count":15,"open_issues_count":4,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-07-22T10:21:18.042Z","etag":null,"topics":["api","client","csharp","dotnet","email","infobip-api","nuget","sms","tfa"],"latest_commit_sha":null,"homepage":"https://www.infobip.com/docs/api","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infobip.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-31T09:38:12.000Z","updated_at":"2025-07-20T03:56:59.000Z","dependencies_parsed_at":"2023-12-28T15:26:49.382Z","dependency_job_id":"5511c7a7-7ba1-4ce9-9ff5-d27c126c10b8","html_url":"https://github.com/infobip/infobip-api-csharp-client","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/infobip/infobip-api-csharp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Finfobip-api-csharp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Finfobip-api-csharp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Finfobip-api-csharp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Finfobip-api-csharp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infobip","download_url":"https://codeload.github.com/infobip/infobip-api-csharp-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infobip%2Finfobip-api-csharp-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267803984,"owners_count":24146527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","csharp","dotnet","email","infobip-api","nuget","sms","tfa"],"created_at":"2024-11-10T03:13:51.520Z","updated_at":"2025-07-30T03:33:36.281Z","avatar_url":"https://github.com/infobip.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Infobip API C# Client\n\n\u003cimg src=\"https://cdn-web.infobip.com/uploads/2023/01/Infobip-logo.svg\" height=\"93px\" alt=\"Infobip\" /\u003e\n\n[![NuGet](https://badgen.net/nuget/v/Infobip.Api.Client?icon=nuget)](https://www.nuget.org/packages/Infobip.Api.Client)\n[![MIT License](https://badgen.net/github/license/infobip/infobip-api-csharp-client)](https://opensource.org/licenses/MIT)\n\nThis is a C# Client for [Infobip API][apidocs] and you can use it as a dependency in your application.\nTo use this library you'll need an Infobip account. You can create a [free trial][freetrial] account [here][signup].\n\nThe library is built on top of [OpenAPI Specification](https://swagger.io/specification/) and powered by [OpenAPI Generator](https://openapi-generator.tech/).\n\n#### Table of contents:\n* [Documentation](#documentation)\n* [General Info](#general-info)\n* [Installation](#installation)\n* [Quickstart](#quickstart)\n* [Ask for help](#ask-for-help)\n\n## Documentation\n\nInfobip API Documentation can be found [here][apidocs].\n\n## General Info\nFor `Infobip.Api.Client` versioning we use [Semantic Versioning][semver] scheme.\n\nPublished under [MIT License][license].\n\n[.NET Standard 2.0](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0) is targeted for usage of this library.\n\n## Installation\nRecommended way of library usage is to install it via [NuGet Package Manager](https://www.nuget.org/downloads).\n\n#### Package Manager UI\nWithin Visual Studio, use the Package Manager UI to browse for `Infobip.Api.Client` package and install the latest version to your project.\n\n#### Package Manager Console\nAlternatively, also within Visual Studio, use the Package Manager Console command:\n\n    Install-Package Infobip.Api.Client -Version 4.0.0\n\n#### .NET CLI\nIf you are used to .NET CLI, the following command is going to be sufficient for you:\n\n    dotnet add package Infobip.Api.Client --version 4.0.0\n\n### Package reference\nIncluding the package directly into project file is also valid option.\n\n    \u003cPackageReference Include=\"Infobip.Api.Client\" Version=\"4.0.0\" /\u003e\n\n## Quickstart\n\n#### Initialize the Client\n\nBefore initializing client we have to prepare `Configuration` object for handling authentication.\nThe library supports the [API Key Header](https://www.infobip.com/docs/essentials/api-essentials/api-authentication#api-key-header) authentication method.\nTo see your base URL, log in to the [Infobip API Resource][apidocs] hub with your Infobip account.\n\n```csharp\n    var configuration = new Configuration()\n    {\n        BasePath = \"\u003cput your base URL here prefixed by https://\u003e\",\n        ApiKey = \"\u003cput your API key here\u003e\"\n    };\n```\n\nNext step is to initialize the API client. In this case we're instantiating the SMS API client.\n```csharp\n    var smsApi = new SmsApi(configuration);\n```\n\nSince library is utilizing the `HttpClient` behind the scene for handling the HTTP calls you can provide your own instance of `HttpClient` to `SendSmsApi` constructor and have a control over its lifecycle.\n```csharp\n    var smsApi = new SmsApi(myHttpClientInstance, configuration);\n```\n\n#### Send an SMS\nHere's a simple example for sending an SMS message. First prepare the message by creating an instance of `SmsRequest` and its nested objects.\n\n```csharp\n    var smsMessage = new SmsMessage(\n        sender: \"SMSInfo\",\n        destinations: new List\u003cSmsDestination\u003e()\n        {\n            new SmsDestination(to: \"41793026727\")\n        },\n        content: new SmsMessageContent(\n            new SmsTextContent(\n                text: \"This is a dummy SMS message sent using Infobip.Api.Client\"\n            )\n        )\n    );\n\n    var smsRequest = new SmsRequest(\n        messages: new List\u003cSmsMessage\u003e\n        {\n            smsMessage\n        }\n    );\n```\n\nNow we can send the message using client instantiated before and inspect the `ApiException` for more information in case of failure.\nYou can get the HTTP status code from `ErrorCode` property, and more details about error from `ErrorContent` property.\n\n```csharp\n    try\n    {\n        var smsResponse = smsApi.SendSmsMessages(smsRequest);\n\n        System.Diagnostics.Debug.WriteLine($\"Status: {smsResponse.Messages.First().Status}\");\n    }\n    catch (ApiException apiException)\n    {\n        var errorCode = apiException.ErrorCode;\n        var errorHeaders = apiException.Headers;\n        var errorContent = apiException.ErrorContent;\n    }\n```\n\nAdditionally, from the successful response (`SmsResponse` object) you can pull out the `bulkId` and `messageId`(s) and use them to fetch a delivery report for given message or bulk.\nBulk ID will be received only when you send a message to more than one destination address or multiple messages in a single request.\n\n```csharp\n    var bulkId = smsResponse.BulkId;\n    var messageId = smsResponse.Messages.First().MessageId;\n```\n\n#### Receive sent SMS report\nFor each SMS that you send out, we can send you a message delivery report in real time. All you need to do is specify your endpoint when sending SMS in `notifyUrl` field of `SmsTextualMessage`, or subscribe for reports by contacting our support team.\ne.g. `https://{yourDomain}/delivery-reports`\n\nYou can use data models from the library and the pre-configured `Newtonsoft.Json` serializer (version 13.0.3).\n\nExample of webhook implementation:\n\n```csharp\n    [HttpPost(\"api/sms/delivery-reports\")]\n    public IActionResult ReceiveDeliveryReport([FromBody] SmsDeliveryResult deliveryResult)\n    {\n        foreach (var result in deliveryResult.Results)\n        {\n            System.Diagnostics.Debug.WriteLine($\"{result.MessageId} - {result.Status.Name}\");\n        }\n        return Ok();\n    }\n```\nIf you prefer to use your own serializer, please pay attention to the supported [date format][datetimeformat].\nLibrary is using custom date format string `yyyy-MM-ddTHH:mm:ss.fffzzzz` when serializing dates. This format does not exactly match the format from our documentation above, but it is the closest possible. This format produces the time zone offset value with `:` as time separator, but our backend services will deserialize it correctly.\n\n#### Fetching delivery reports\nIf you are for any reason unable to receive real time delivery reports on your endpoint, you can use our [Delivery reports API](https://www.infobip.com/docs/api/channels/sms/logs-and-status-reports/get-outbound-sms-message-delivery-reports) to fetch them.\nEach request will return a batch of delivery reports - only once.\nYou can filter reports by multiple parameters (see API's documentation for full list), for example, by `bulkId`, `bulkId` and `limit` like in the snippet below:\n\n```csharp\n    var numberOfReportsLimit = 10;\n    var smsDeliveryResult = smsApi.GetOutboundSmsMessageDeliveryReports(\n        bulkId: bulkId,\n        messageId: messageId,\n        limit: numberOfReportsLimit\n    );\n\n    foreach (var smsReport in smsDeliveryResult.Results)\n    {\n        Console.WriteLine($\"{smsReport.MessageId} - {smsReport.Status.Name}\");\n    }\n```\n\n#### Unicode \u0026 SMS preview\nInfobip API supports Unicode characters and automatically detects encoding. Unicode and non-standard GSM characters use additional space, avoid unpleasant surprises and check how different message configurations will affect your message text, number of characters and message parts.\nUse the preview SMS message functionality to verify those details as demonstrated below.\n\n```csharp\n    var smsPreviewRequest = new SmsPreviewRequest(\n        text: \"Let's see how many characters will remain unused in this message.\"\n    );\n\n    var smsPreviewResponse = smsApi.PreviewSmsMessage(smsPreviewRequest);\n```\n\n#### Receive incoming SMS\nIf you want to receive SMS messages from your subscribers we can have them delivered to you in real time.\nWhen you buy and configure a number capable of receiving SMS, specify your endpoint as explained [here][receive-inbound-sms] e.g. `https://{yourDomain}/incoming-sms`.\n\nExample of webhook implementation:\n\n```csharp\n    [HttpPost(\"api/sms/incoming-sms\")]\n    public IActionResult ReceiveSms([FromBody] SmsInboundMessageResult smsInboundMessageResult)\n    {\n        foreach (var result in smsInboundMessageResult.Results)\n        {\n            System.Diagnostics.Debug.WriteLine($\"{result.From} - {result.CleanText}\");\n        }\n        return Ok();\n    }\n```\n#### Two-Factor Authentication (2FA)\nFor 2FA quick start guide please check [these examples](two-factor-authentication.md).\n\n#### Send email\nFor send email quick start guide please check [these examples](email.md).\n\n#### Moments\nFor Flow \u0026 Forms quick start guide please check [these examples](moments.md).\n\n## Ask for help\n\nFeel free to open issues on the repository for any issue or feature request. \nCheck the `CONTRIBUTING` [file][contributing] for details about contributions - in short, we will not merge any pull requests since this code is auto-generated.\n\nHowever, if you find something that requires our imminent attention feel free to contact us @ [support@infobip.com](mailto:support@infobip.com).\n\n[apidocs]: https://www.infobip.com/docs/api\n[freetrial]: https://www.infobip.com/docs/essentials/getting-started/free-trial\n[signup]: https://www.infobip.com/signup\n[semver]: https://semver.org\n[license]: LICENSE\n[contributing]: CONTRIBUTING.md\n[authentication-apikey]: https://www.infobip.com/docs/essentials/api-authentication#api-key-header\n[datetimeformat]: https://www.infobip.com/docs/essentials/api-essentials/integration-best-practices#date-formats-backward-compatibility\n[receive-inbound-sms]: https://www.infobip.com/docs/api/channels/sms/inbound-sms/receive-inbound-sms-messages\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfobip%2Finfobip-api-csharp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfobip%2Finfobip-api-csharp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfobip%2Finfobip-api-csharp-client/lists"}