The purpose of the code snippets project is to provide simple examples focused on one goal. For example, sending an SMS, handling an incoming SMS webhook or making a Text to Speech call.
These code examples are meant to be used in the manner described on Nexmo's Developer Portal for example Sending an SMS. This repo is structured in such a way as to support internal testing. Developers are free to use these snippets as a reference - but they may require some changes to get them to work inside your application.
If you'd like to run this application yourself you'll need to configure your Nexmo Credentials
To use this sample you will first need a Nexmo account. Once you have your own API credentials, you'll need to set them in the Client Constructors - for most of the API's you can set them in BasicAuth.cs.
For Voice API usage you will need to set the Application ID and Private Key as well in the FullAuth.cs file
Alternatively, provide the nexmo URLs, API key, secret, and application credentials (for JWT) in appsettings.json:
{
"appSettings": {
"Nexmo.UserAgent": "myApp/1.0",
"Nexmo.Url.Rest": "https://rest.nexmo.com",
"Nexmo.Url.Api": "https://api.nexmo.com",
"Nexmo.api_key": "NEXMO-API-KEY",
"Nexmo.api_secret": "NEXMO-API-SECRET",
"Nexmo.Application.Id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
"Nexmo.Application.Key": "NEXMO_APPLICATION_PRIVATE_KEY"
}
}For some of the examples, you will need to buy a number.
Nexmo permanently disabled support of legacy TLSv1 and TLSv1.1 protocols. Vulnerabilities within these TLS versions are serious and, left unaddressed, put organizations at risk of being breached. The only supported encryption protocol for HTTPS connections is now TLSv1.2. All API requests and all web requests to the Nexmo Dashboard using legacy TLS protocols will be rejected.
In case you are still using a legacy TLS protocol, make sure to force your app to TLSv1.2 by adding this line of code :
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;Please raise an issue to request an example that isn't present within the code snippets. Pull requests will be gratefully received.
This code is licensed under the MIT license.