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
npm install chatkitty-platform-sdk
yarn 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.
// configure
const chatkitty = new ChatKitty({
clientId: 'CLIENT-ID',
clientSecret: 'CLIENT-SECRET'
});
// use
try {
const application = await chatkitty.retrieveAuthenticatedApplication();
console.log(application.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