Getting Started

We have an open source netstandard library available @ https://github.com/cmdotcom/talk-sdk-dotnet that enables you to use the API directly from a .NET or .NET Core application. You can install it from Nuget using the following command in the Nuget Console:

Install-Package CM.Voice.VoiceApi.Sdk

or search for CM.Voice.VoiceApi.Sdk in the Nuget Package Manager.

This is the easiest way to get your first call out, but if you are using another programming language or platform, sending a POST command with some JSON is usually fairly straight-forward.

Below you can find some examples, including .NET using the SDK, but also the plain JSON to send and an example using cURL (tip: you can import the cURL call into Postman).

Please note that all examples use a random (not working) API Key, so you will need to replace this with your own (always keep your key secret!). The same goes for the callee number.

Examples

C#

  var myApiKey = Guid.Parse("00000000-0000-0000-0000-000000000000");
  var httpClient = new HttpClient();
  var client = new VoiceApiClient(httpClient, myApiKey);
  var instruction = new NotificationInstruction
  {
      Caller = "003176xxxxxxx",
      Callee = "00316xxxxxxxx",
      Prompt = "This is a test notification call using the C M voice A P I.",
      MaxReplays = 2,
      ReplayPrompt = "Press 1 to repeat this message."
  };
  var result = await client.SendAsync(instruction).ConfigureAwait(false);

cURL

curl -X POST \
  https://api.cm.com/voiceapi/v2/Notification\
  -H 'Content-Type: application/json' \
  -H 'X-CM-PRODUCTTOKEN: 00000000-0000-0000-0000-000000000000' \
  -d '{
  "callee": "00316xxxxxxxx",
  "caller": "003176xxxxxxx",
  "prompt": "This is a test notification call using the C M voice A P I.",
  "prompt-type": "TTS"
}'

JSON

{
  "callee": "00316xxxxxxxx",
  "caller": "003176xxxxxxx",
  "prompt": "This is a test notification call using the C M voice A P I.",
  "prompt-type": "TTS"
}

Swagger

The Voice Api has Swagger documentation available:

Swagger UI

Swagger JSON

When using the UI, please note that you need to enter your Api Key in the authorization (see button in the top right of the page). If your Voice Account has more than one Api Account, please also enter the Key of the Api Account to use.

Postman

You can download a Postman collection with example calls to the Voice API:

Voice API Postman collection


Did this page help you?