AI Chat SaaS - SDK Implementation Guide
Overview
We provide official SDKs for all major programming languages to make integration seamless.
Supported SDKs
Frontend SDKs
- JavaScript/TypeScript - npm package
- React - React components + hooks
- Vue.js - Vue 3 composables
- Angular - Angular services + modules
- Svelte - Svelte stores + components
Backend SDKs
- C# / .NET - NuGet package
- Python - PyPI package
- Node.js/TypeScript - npm package
- PHP - Composer package
- Ruby - RubyGems
- Go - Go module
- Java - Maven/Gradle
- Rust - Crates.io
Mobile SDKs
- iOS (Swift) - CocoaPods/SPM
- Android (Kotlin) - Maven
- React Native - npm
- 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 SDKSDK 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/sdkReact
bash
npm install @aichat/reactPython
bash
pip install aichat-sdk.NET
bash
dotnet add package AIChat.SDKGo
bash
go get github.com/aichat/sdk-goQuick 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:
- API Key (recommended for backend)
- JWT Token (frontend after login)
- OAuth2 (Google, Microsoft, GitHub)
- 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:
- Fork the repository
- Create feature branch
- Write tests
- 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