The VTS .NET SDK makes it simpler to integrate communications into your .NET applications using the VTS REST APIs. Using the SDK, you’ll be able to make voice calls, send SMS messages, and generate VTS XML documents to control your call flows.
Supported .NET versions: This SDK was written targeting at .NET Standard 1.3, and thus works with .NET Framework 4.6 and higher and .NET Core 1.0 and higher. Check here to know about all the other supported platforms.
You can install this SDK either by referencing the .dll file or by using NuGet.
To install the latest SDK using the NuGet CLI:
PM> Install-Package VTS -Version 4.1.3
To use NuGet to install the SDK in Visual Studio:
1. Run NuGet and choose Package Manager: Add Package
2. Enter package name: vts
3. Select package name and version
You can also use the .NET CLI to install the package:
> dotnet add package vts --version 4.1.3
To make the API requests, you need to create a VTSApi instance and provide it with authentication credentials, which you can find on the Overview page of the VTS console.
var api = new VTSApi("<auth_id>","<auth_token>");
Replace the auth placeholders with your authentication credentials from the VTS console.
The SDK uses consistent interfaces to create, retrieve, update, delete, and list resources. The pattern is:
api.Resource.Create(params);
api.Resource.Get(params);
api.Resource.Update(identifier, params);
api.Resource.Delete(identifier);
List();
Using api.Resource.List() lists the first 20 resources by default (the first page, with limit as 20, and offset as 0). Use limit and offset to get more pages of resources.
internal class Program
{
public static void Main(string[] args)
{
var api = new VTSApi("<auth_id>","<auth_token>");
var response = api.Message.Create(
src:"<source_number>",
dst:"<destination_number>",
text:"Hello, world!"
);
Console.WriteLine(response);
}
}
Replace the auth placeholders with your authentication credentials from the VTS console. Replace the phone number placeholders with actual phone numbers in E.164 format (for example, +12025551234).
internal class Program
{
public static void Main(string[] args)
{
var api = new VTSApi("<auth_id>","<auth_token>");
var response = api.Call.Create(
to:new List<String>{"<destination_number>"},
from:"<caller_id>",
answerMethod:"GET",
answerUrl:"https://<answer.url>"
);
Console.WriteLine(response);
}
}
class MainClass
{
public static void Main(string[] args)
{
VTS.XML.Response response = new VTS.XML.Response();
response.AddSpeak("Hello, world!",
new Dictionary<string, string>() { });
Console.WriteLine(response.ToString());
}
}
This generates the following XML:
<Response>
<Speak>Hello, world!</Speak>
</Response>
Refer to the VTS API Reference documentation for more examples.
Report feedback or problems with this SDK by opening an issue on GitHub.