NAV Navbar

Triniti API SDK

Triniti Cloud .NET SDK

The .Net SDK uses the [Triniti Developer Cloud][wdc] services, a collection of REST APIs and SDKs that use cognitive computing to solve complex problems.

Prerequisites for using .NET SDK

Ensure you have the following prerequisites:

Installing the Triniti .NET Standard SDK

You can get the latest SDK packages through NuGet. Installation instructions can be found in the ReadMe of each package.

TrinitiAIService

The Triniti AI service combines machine learning, natural language understanding, and integrated dialog tools to create conversation flows between your apps and your users.

Nuget

PM > Install-Package Triniti.CloudSDK.Assistant.v1

Triniti Cloud SDK

This is the core package for the Triniti Developer Cloud .NET Standard SDK. All service packages depend on this package to connect to Triniti services via REST or Websockets.

Nuget

PM > Install-Package Triniti.CloudSDK

Authentication

Triniti services require API Key and API Secrete to authenticate api request as well as identifying workspace.

Getting credentials

To find out which authentication to use, view the service credentials. You find the service credentials for authentication the same way for all Triniti services:

  1. Go to the Triniti Cloud Dashboard page.
  2. Click an setting icon on left panel.
  3. Copy the apikey and api secret.

In your code, you can use these values in the service constructor or with a method call after instantiating your service.

Initiating Triniti AI Services

void Example()
{
     TokenOptions tokenOption = new TokenOptions();
     tokenOption.ApiKey = "<api-key>";
     tokenOption.ApiAccessKey = "<api-secret>";

     TrinitiAIService aiService = new TrinitiAIService(tokenOption, "v2");
}

Sending Message

You can send custom request headers by adding them to the customData object.

void Example()
{

    TokenOptions tokenOption = new TokenOptions();
    tokenOption.ApiKey = "<api-key>";
    tokenOption.ApiAccessKey = "<api-secret>";

    TrinitiAIService aiService = new TrinitiAIService(tokenOption, "v2");

    //  create message request
     TrinityMessageRequest messageRequest0 = new TrinityMessageRequest()
     {
         Input = "I want , book my - flight ticket",
         CurrentIntent = "txn-bookflight",
         Options = new List<string> { "fragment", "debug", "semantics", "expansion" },
         TrinitiStateContext = "",
         ClientStateContext = new Dictionary<string, string> { { "user" , "a" }, { "txn","124345"} }
      };

    var results = asd.SendMessage( messageRequest0,"<userID>","<sessionID>");
}

Custom Request Headers

You can send custom request headers by adding them to the customData object.

void Example()
{

    TokenOptions tokenOption = new TokenOptions();
    tokenOption.ApiKey = "<api-key>";
    tokenOption.ApiAccessKey = "<api-secret>";

    TrinitiAIService aiService = new TrinitiAIService(tokenOption, "v2");

    //  Create customData object
    Dictionary<string, object> customData = new Dictionary<string, object>();
    //  Create a dictionary of custom headers
    Dictionary<string, string> customHeaders = new Dictionary<string, string>();
    //  Add to the header dictionary
    customHeaders.Add("X-Triniti-Metadata", "customer_id=some-assistant-customer-id");
    //  Add the header dictionary to the custom data object
    customData.Add(Constants.String.CUSTOM_REQUEST_HEADERS, customHeaders);

    var results = aiService.TrinitiMessage("<message-request>", "<userID>","<sessionID>",customData: customData);
}

Response Headers

You can get the response headers and the raw json response in the result object.

void Example()
{
    TrinitiAIService aiService = new TrinitiAIService("<TokenOption>", "v2");

    var responseHeaders = aiService.ResponseHeaders;  //  The response headers
    var responseJson = aiService.ResponseJson;        //  The raw response json
}

Self signed certificates

You can disable SSL verification on calls to Triniti (only do this if you really mean to!).

void Example()
{
    TrinitiAIService aiService = new TrinitiAIService("<TokenOption>", "v2");
    aiService.SendAsInsecure(true);
    var results = aiService.TrinitiMessage("<message-request>", "<userID>","<sessionID>");
}

Workflow

Fulllfillment Response JSON Structure

Fulllfillment Response SDK

Webhook Signature

Workflow Script Reference

Webhook Reference

HelloTicket

HelloWorld

Channel SDK

Channel SDK's - IOS Hybrid

Triniti iOS SDKs are distrubuted through CocoaPods.There are 2 SDKs which developer can use to create conversation feature in their app.

MFSDKHybridKit

MFSDKHybridKit is a core SDK which provides a lightweight conversational / messaging UX interface for users to interact to the Triniti Platform.

Version Date Pod Name
1.3.42 March 29, 2019 MFSDKHybridKit

MFSDKVoiceKit

MFSDKVoiceKit SDK provides a feature to add voice capability to mobile application.It supports speech to text and text to speech functioanlity

Version Date Pod Name
1.3.42 March 29, 2019 MFSDKVoiceKit

Channel SDK's - Android Hybrid

Triniti Android SDKs are distrubuted through Artifactory.There are 2 SDKs which developer can use to create conversation feature in their app.

MFSDKHybridKit

MFSDKWebKit is a core SDK which provides a lightweight conversational / messaging UX interface for users to interact to the Triniti Platform.

Version Date Gradle dependency
1.3.41 March 29, 2019 com.morfeus.android:MFSDKHybridKit:1.3.41

MFSDKVoiceKit

MFSDKVoiceKit SDK provides a feature to add voice capability to mobile application. It supports speech to text and text to speech functioanlity

Version Date Gradle dependency
1.1.6 March 29, 2019 com.morfeus.android.voice:MFSDKVoice:1.1.6

MFSecurityKit

MFSecurityKit SDK provides set of security features to mobile application. It supports SafetyNet Attestation API and Root detection.

Version Date Gradle dependency
1.3.30 March 29, 2019 com.morfeus.android:MFSecurityKit:1.3.30

Channel SDK's - Web

Triniti CLI

A Command line utility for Triniti AI

Prerequisites

Ensure you have the following prerequisites:

Installing

$ npm install -g triniti-cli

Available commands

Usage

$ triniti-cli [COMMAND] [ ...args ]

Version check

USAGE
  $ triniti-cli (-v|--version|version)

Configure

Manage Triniti Cli configuration

Triniti Cli expects the following keys to be set.

  1. api-key
  2. api-secret
  3. username
  4. password
  5. workspace-id
USAGE
  $ triniti-cli conf [KEY] [VALUE]

ARGUMENTS
  KEY       key of the config
  VALUE     value of the config

OPTIONS
  -d, --delete            delete the key
  -k, --key=key           key of the config
  -v, --value=value       value of the config


EXAMPLE

    list configurations
    $ triniti-cli conf

    Set a configuration
    $ triniti-cli conf [KEY] [VALUE]
    $ triniti-cli conf username test1

    Get a value configured
    $ triniti-cli conf [KEY]
    $ triniti-cli conf username

    Remove a configuration
    $ triniti-cli conf [KEY] -d
    $ triniti-cli conf username -d

FAQ

Add/Remove FAQs in the workspace

USAGE
  $ triniti-cli faq

OPTIONS
  -h, --help           show help for faq command
  -a, --add=add        add faq(s)
  -r, --remove=remove  remove faq
  -R, --removeAll      remove all faqs

EXAMPLE

    Add faqs
    $ triniti-cli faq -a filename.csv

    Remove a faq
    $ triniti-cli faq -r faqId

    Remove all faqs
    $ triniti-cli faq -R

Train

Train the AI models

USAGE
  $ triniti-cli train

OPTIONS
  -h, --help       show help for train command
  -s, --status     display current status of training
  -d, --days       display status of training for days configured

EXAMPLE

    Train AI models in the workspace
    $ triniti-cli train --type [full | shallow]

    Get the status of training
    $ triniti-cli train --status

    Get the status of training for specific number of days
    $ triniti-cli train --status --days=30

Help

Displays CLI help menu

USAGE
  $ triniti-cli help  

Next Steps

Triniti Api Reference

Know more about the API reference and versions.

Integrate with API

Findout more how to integrate with our API