rajanadar / nexmo-dotnet

Nexmo REST API client for .NET, ASP.NET, ASP.NET MVC written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nexmo Client Library for C#/.NET

You can use this C# client library to add Nexmo's API to your application. To use this, you'll need a Nexmo account. Sign up for free at nexmo.com.

Installation:

To use the client library you'll need to have created a Nexmo account.

To install the C# client library using NuGet:

  • Run the following command in the Package Manager Console:
    Install-Package Nexmo.Csharp.Client

Alternatively:

  • Download or build (see developer instructions) the Nexmo.Api.dll.
  • If you have downloaded a release, ensure you are referencing the Newtonsoft.Json.dll dependency by either including it with your project's NuGet dependencies or manually referencing it.
  • Reference the assembly in your code.

Configuration:

  • Provide your API key, secret, and nexmo URLs in appSettings:
<add key="Nexmo.Url.Rest" value="https://rest.nexmo.com" />
<add key="Nexmo.Url.Api" value="https://api.nexmo.com" />
<add key="Nexmo.api_key" value="<YOUR KEY>" />
<add key="Nexmo.api_secret" value="<YOUR SECRET>" />

Examples

The following examples show how to:

Sending A Message

Use Nexmo's SMS API to send a SMS message.

var results = SMS.Send(new SMS.SMSRequest
{
    from = "15555551212",
    to = "17775551212",
    text = "this is a test"
});

Receiving a Message

Use Nexmo's SMS API to receive a SMS message. Assumes your Nexmo endpoint is configured.

public ActionResult Get([FromUri]SMS.SMSDeliveryReceipt response)
{
    return new HttpStatusCodeResult(HttpStatusCode.OK);
}

Initiating a Call

Use Nexmo's Call API to initiate a voice call.

var result = Voice.Call(new Voice.CallCommand
{
    to = "17775551212",
    answer_url = "https://abcdefgh.ngrok.io/content/voiceDemo.xml",
    status_url = "https://abcdefgh.ngrok.io/api/voice",
    from = "15555551212",
});

Additional Examples

  • Check out the sample MVC application and tests for more examples. Make sure to copy web.config.example to web.config and enter your key/secret.

API Coverage

  • Account
    • Balance
    • Pricing
    • Settings
    • Top Up
    • Numbers
      • Search
      • Buy
      • Cancel
      • Update
  • Number Insight
    • Basic
    • Standard
    • Advanced
    • Webhook Notification
  • Verify
    • Verify
    • Check
    • Search
    • Control
  • Search
    • Message
    • Messages
    • Rejections
  • Messaging
    • Send
    • Delivery Receipt
    • Inbound Messages
    • Search
      • Message
      • Messages
      • Rejections
    • US Short Codes
      • Two-Factor Authentication
      • Event Based Alerts
        • Sending Alerts
        • Campaign Subscription Management
  • Voice
    • Outbound Calls
    • Inbound Call
    • Text-To-Speech Call
    • Text-To-Speech Prompt

Contributing

We are currently targeting the 4.5.2 - 4.6.1 frameworks and using Visual Studio 2015 Update 1.

  1. Get latest code either by cloning the repository or downloading a snapshot of the source.
  2. Open "Nexmo.Api.sln"
  3. Build! NuGet dependencies should be brought down automatically; check your settings if they are not.

Pull requests are welcome!

License

This library is released under the MIT License

About

Nexmo REST API client for .NET, ASP.NET, ASP.NET MVC written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

License:MIT License


Languages

Language:C# 99.5%Language:CSS 0.4%Language:ASP 0.1%Language:JavaScript 0.1%