Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.
/ RestClient Public archive

A simple client you can use in your projects to connect to a COGNIGY.AI REST endpoint.

License

Notifications You must be signed in to change notification settings

Cognigy/RestClient

Repository files navigation

🚨 Deprecation Notice: This Repository is Inactive and no longer maintained 🚨

CognigyClient

Repo for the cognigy (server) client which can be used to connect to the Cognigy.AI platform from server applications written in Node.JS.

This client is only compatible with the 3.X version of our product and will no longer work with the old 2.X versions!

Installation

To install the cognigy client for your server project, use the following:

npm i @cognigy/cognigy-rest-client --save

Usage

If you want to use the CognigyClient you have to create a REST Endpoint on the COGNIGY.AI platform. For a detailed description of creating and configuring a REST Endpoint see our Documentation.

Requirements

You'll need two bits of information from our COGNIGY.AI platform to sucessfully connect to your configured Socket Endpoint:

  • The URL of the REST Endpoint

You can find them on the Endpoint Editor page of your REST Endpoint.

Example

You get you started quickly, simply copy-paste this sample code and adjust your options where necessary.

import * from "@cognigy/cognigy-rest-client";

const options : OptionsREST = {
    /** Required fields */
    url: 'endpoint-url',
    userId: 'your-user-id',
    sessionId: 'session-id',
    channel: 'REST',
    handleOutput: (output) => {
        console.log("Text: " + output.text + "   Data: " + JSON.stringify(output.data));
    },

    /** Optional fields */
    keepMarkup: true,
    handleError: (error: string) => { console.log(error); },
};

const client: CognigyRESTClient = new CognigyRESTClient(options);
client.sendMessage("I like pizza", { key: "value" });

About

A simple client you can use in your projects to connect to a COGNIGY.AI REST endpoint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published