C# / .NET SDK

Installation

The recommended way to install the Unimatrix SDK for .NET is to use the nuget package manager, which is available on NuGet.

If you are building with the .NET CLI, run the following command to add UniSdk as a dependency to your project:

dotnet add package UniSdk

If you are using the Visual Studio IDE, run the following command in the Package Manager Console:

Install-Package UniSdk

Usage

The following example shows how to use the Unimatrix .NET SDK to interact with Unimatrix services.

Send SMS

Send a text message to a single recipient.


using System;
using UniSdk;

namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
            // initialization
            var client = new UniClient("your access key id", "your access key secret"); // if you use the simple auth mode, just pass in the first parameter

            // send the message
            try
            {
                var resp = client.Messages.Send(new {
                    to = "your phone number", // in E.164 format
                    signature = "your sender name",
                    content = "Your verification code is 2048."
                });
                Console.WriteLine(resp.Data);
            } catch (UniException ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}

Send a message using a template with variables.

client.Messages.Send(new {
    to = "+1650253xxxx",
    signature = "Unimatrix",
    templateId = "pub_verif_en_basic2",
    templateData = new {
        code = "2048"
    }
});