Skip to content

AI Chat SaaS - SDK Implementation Guide

Overview

We provide official SDKs for all major programming languages to make integration seamless.

Supported SDKs

Frontend SDKs

  1. JavaScript/TypeScript - npm package
  2. React - React components + hooks
  3. Vue.js - Vue 3 composables
  4. Angular - Angular services + modules
  5. Svelte - Svelte stores + components

Backend SDKs

  1. C# / .NET - NuGet package
  2. Python - PyPI package
  3. Node.js/TypeScript - npm package
  4. PHP - Composer package
  5. Ruby - RubyGems
  6. Go - Go module
  7. Java - Maven/Gradle
  8. Rust - Crates.io

Mobile SDKs

  1. iOS (Swift) - CocoaPods/SPM
  2. Android (Kotlin) - Maven
  3. React Native - npm
  4. Flutter - pub.dev

SDK Directory Structure

sdks/
├── javascript/           # Core JavaScript SDK
├── typescript/           # TypeScript definitions
├── react/               # React SDK
├── vue/                 # Vue SDK
├── angular/             # Angular SDK
├── svelte/              # Svelte SDK
├── dotnet/              # C#/.NET SDK
├── python/              # Python SDK
├── nodejs/              # Node.js SDK
├── php/                 # PHP SDK
├── ruby/                # Ruby SDK
├── go/                  # Go SDK
├── java/                # Java SDK
├── rust/                # Rust SDK
├── ios/                 # iOS SDK
├── android/             # Android SDK
├── react-native/        # React Native SDK
└── flutter/             # Flutter SDK

SDK Features

Core Features (All SDKs)

  • ✅ Authentication (login, register, refresh)
  • ✅ User management
  • ✅ Workspace management
  • ✅ Real-time chat (WebSocket)
  • ✅ Message sending/receiving
  • ✅ File upload
  • ✅ Typing indicators
  • ✅ Presence (online/offline)
  • ✅ AI interactions
  • ✅ Workflow triggers
  • ✅ Analytics events

Frontend-Specific Features

  • ✅ Widget embedding
  • ✅ Customizable UI components
  • ✅ Theme customization
  • ✅ Event hooks/callbacks
  • ✅ Offline support
  • ✅ Push notifications

Backend-Specific Features

  • ✅ Webhook handling
  • ✅ API key authentication
  • ✅ Batch operations
  • ✅ Server-side rendering support
  • ✅ Connection pooling
  • ✅ Retry logic with exponential backoff

Installation Examples

JavaScript/TypeScript

bash
npm install @aichat/sdk
# or
yarn add @aichat/sdk

React

bash
npm install @aichat/react

Python

bash
pip install aichat-sdk

.NET

bash
dotnet add package AIChat.SDK

Go

bash
go get github.com/aichat/sdk-go

Quick Start Examples

JavaScript

javascript
import { AIChatClient } from '@aichat/sdk';

const client = new AIChatClient({
  apiKey: 'your_api_key',
  workspaceId: 'your_workspace_id'
});

await client.auth.login({ email, password });
const messages = await client.chat.getMessages();

React

jsx
import { AIChatProvider, useChat } from '@aichat/react';

function App() {
  return (
    <AIChatProvider workspace="ws_xxx">
      <ChatWidget />
    </AIChatProvider>
  );
}

function ChatWidget() {
  const { messages, sendMessage } = useChat();
  
  return <div>{/* Your UI */}</div>;
}

Python

python
from aichat import AIChatClient

client = AIChatClient(api_key="your_api_key")
messages = client.chat.get_messages(conversation_id="conv_xxx")

C#

csharp
using AIChat.SDK;

var client = new AIChatClient("your_api_key");
var messages = await client.Chat.GetMessagesAsync("conv_xxx");

Authentication Methods

All SDKs support multiple authentication methods:

  1. API Key (recommended for backend)
  2. JWT Token (frontend after login)
  3. OAuth2 (Google, Microsoft, GitHub)
  4. Session Cookies (web applications)

WebSocket Support

All SDKs include built-in WebSocket support for real-time features:

javascript
client.on('message.received', (message) => {
  console.log('New message:', message);
});

client.on('user.typing', (data) => {
  console.log('User typing:', data.userId);
});

Error Handling

Consistent error handling across all SDKs:

javascript
try {
  await client.chat.sendMessage({ content: "Hello" });
} catch (error) {
  if (error instanceof AIChatError) {
    console.error('Error:', error.code, error.message);
  }
}

TypeScript Support

All JavaScript/TypeScript SDKs include full type definitions:

typescript
import type { Message, Conversation, User } from '@aichat/sdk';

const message: Message = await client.chat.sendMessage({
  conversationId: "conv_xxx",
  content: "Hello"
});

Testing

All SDKs include comprehensive test suites:

  • Unit tests
  • Integration tests
  • E2E tests
  • Mock server for testing

Documentation

Each SDK includes:

  • README with quick start
  • API reference documentation
  • Code examples
  • Migration guides
  • Changelog

Release Schedule

  • Major versions: Breaking changes (every 12+ months)
  • Minor versions: New features (every 2-3 months)
  • Patch versions: Bug fixes (as needed)

Support

  • GitHub Issues for bug reports
  • Discord community for questions
  • Email support for enterprise customers
  • Stack Overflow tag: aichat-sdk

Contributing

All SDKs are open source (MIT License) and accept contributions:

  1. Fork the repository
  2. Create feature branch
  3. Write tests
  4. Submit pull request

Roadmap

Q1 2026

  • [x] JavaScript/TypeScript SDK
  • [x] React SDK
  • [x] Python SDK
  • [x] .NET SDK
  • [ ] Vue SDK
  • [ ] Node.js SDK

Q2 2026

  • [ ] Go SDK
  • [ ] PHP SDK
  • [ ] Ruby SDK
  • [ ] Angular SDK

Q3 2026

  • [ ] Java SDK
  • [ ] iOS SDK
  • [ ] Android SDK
  • [ ] React Native SDK

Q4 2026

  • [ ] Rust SDK
  • [ ] Flutter SDK
  • [ ] Svelte SDK

Embed AI-powered live chat into any product.