@solveo-ai/sdk-core
v0.1.7
Published
Core TypeScript SDK for Solveo AI platform
Readme
@solveo-ai/sdk-core
Core TypeScript SDK for the Solveo AI platform. Platform-agnostic client library for accessing Solveo APIs.
Installation
npm install @solveo-ai/sdk-core
# or
yarn add @solveo-ai/sdk-core
# or
pnpm add @solveo-ai/sdk-coreQuick Start
Widget Mode (Public Endpoints)
import { SolveoSDK } from '@solveo-ai/sdk-core';
const sdk = new SolveoSDK({
apiUrl: 'https://api.solveoai.io',
widgetId: 'your-widget-id',
platform: 'web',
});
// Create a conversation
const conversation = await sdk.widgetConversations.create({
widget_id: 'your-widget-id',
customer_email: '[email protected]',
});
// Send a message
const response = await sdk.widgetMessages.send(conversation.id, {
content: 'Hello!',
});Management Mode (Authenticated)
import { SolveoSDK } from '@solveo-ai/sdk-core';
const sdk = new SolveoSDK({
apiUrl: 'https://api.solveoai.io',
platform: 'node',
});
// Login
const { access_token } = await sdk.auth.login({
email: '[email protected]',
password: 'password',
});
// SDK automatically sets the token
// Or manually: sdk.setToken(access_token);
// List agents
const agents = await sdk.agents.list('account-id');
// Get analytics
const metrics = await sdk.analytics.getMetrics('account-id', 30);Real-time Communication
WebSocket Streaming (AI Responses)
import { createStreamingSocket } from '@solveo-ai/sdk-core';
const stream = createStreamingSocket('https://api.solveoai.io', conversationId);
stream.on('connect', () => console.log('Connected'));
stream.on('message', (msg) => {
if (msg.type === 'agent_message_chunk') {
console.log('Chunk:', msg.content);
}
});
stream.connect();
stream.sendMessage('Hello!');Socket.IO (Escalations)
import { createCustomerSocket, CustomerSocketManager } from '@solveo-ai/sdk-core';
const socket = createCustomerSocket('https://api.solveoai.io', conversationId);
const manager = new CustomerSocketManager(socket);
manager.onAgentConnected((data) => {
console.log('Agent connected:', data.agent_name);
});
manager.requestHuman();API Reference
See full documentation.
License
MIT
