Platform SDK
The ChatKitty Platform SDK library provides convenient access to the ChatKitty Platform API for Node.js applications.
Installing the ChatKitty Platform SDK
For Node.js apps
- npm
- Yarn
- pnpm
npm install chatkitty-platform-sdk
yarn add chatkitty-platform-sdk
pnpm add chatkitty-platform-sdk
tip
An instance of the Platform SDK is auto-configured and accessible in all chat functions.
Usage
To configure the platform SDK for your Node.js application, you will need the client ID and client secret key for your ChatKitty application. You can find this in the settings tab on the ChatKitty Dashboard.
// import
import {ChatKitty} from 'chatkitty-platform-sdk';
// configure
const chatkitty = new ChatKitty({
clientId: 'CLIENT-ID',
clientSecret: 'CLIENT-SECRET'
});
// use
try {
const response = await chatkitty.Application.retrieveAuthenticatedApplication();
console.log(response.data);
} catch (error) {
if (error.response) {
console.log(error.response.status);
console.log(error.response.data);
} else {
console.log(error.message);
}
}
note
An instance of the Platform SDK is auto-configured in your chat functions and can be accessed using context.ChatKitty