Welcome to the documentation for the Kanvas SDK, a TypeScript SDK designed exclusively to seamlessly connect with the Kanvas Niche ecosystem. This SDK is crafted to enhance the development of headless applications by providing easy-to-use interfaces for interacting with various modules within the Kanvas Niche ecosystem.
To begin using the Kanvas SDK in your project, follow these simple steps:
npm install @kanvas/core
Before using any module, you need to authenticate your application with the Kanvas Niche ecosystem. Obtain your API keys from the Kanvas Niche dashboard and initialize the SDK with the following code:
import KanvasCore, { genericAuthMiddleware } from '@kanvas/core';
// Function to retrieve the authentication token from cookies
const getKey = async (): Promise<string | null> => {
return localStorage.getItem("token") || null // wherever you have saved the user token
};
// Initialize Kanvas Core
const client= new KanvasCore({
url: 'kanvas-url',
key: 'your-kanvas-api-key',
middlewares: [genericAuthMiddleware(getKey)]
});
The Kanvas Niche SDK provides specific modules for common problems encountered during headless app development. Here are the key modules:
The Ecosystem module handles authentication, teams, and company-related functionalities.
The Inventory module manages products, variants, and distribution channels.
The Social module deals with follows, comments, reactions, and messaging features.
The CRM module covers leads, deals, and pipelines for customer relationship management.
Here are some basic examples demonstrating how to use the Kanvas Niche SDK:
const user = await client.auth.login(email, password);
console.log(user);
const products = await client.inventory.getProduct();
console.log(products);
const leads = await client.lead.getAllLeads();
console.log(leads);
For a comprehensive list of available methods and their descriptions, refer to the API Reference.
If you'd like to contribute to the Kanvas Niche SDK, please follow our Contribution Guidelines. TBD
If you have any questions, feedback, or issues, feel free to reach out to our team at the TBD
Happy coding with Kanvas!