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.
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.
- 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>" />
The following examples show how to:
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"
});
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);
}
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",
});
- 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.
- 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
We are currently targeting the 4.5.2 - 4.6.1 frameworks and using Visual Studio 2015 Update 1.
- Get latest code either by cloning the repository or downloading a snapshot of the source.
- Open "Nexmo.Api.sln"
- Build! NuGet dependencies should be brought down automatically; check your settings if they are not.
Pull requests are welcome!
This library is released under the MIT License