gtateth_flutter_sdk 0.1.0
gtateth_flutter_sdk: ^0.1.0 copied to clipboard
Official Flutter SDK and native UI components for g-tateth chat widget integration.
gtateth_flutter_sdk #
Native Flutter SDK and UI components for integrating g-tateth chat on mobile.
Features #
- Typed client for
/api/widget/*endpoints - Session initialization and token handling
- Send/fetch messages
- Online agents and settings fetch
- Conversation lifecycle helpers
- Socket.IO realtime support
- Ready-to-use native Flutter chat widget
Install #
Add to your app pubspec.yaml:
dependencies:
gtateth_flutter_sdk:
path: ../sdks/flutter
Quick Start #
import 'package:flutter/material.dart';
import 'package:gtateth_flutter_sdk/gtateth_flutter_sdk.dart';
class SupportScreen extends StatelessWidget {
const SupportScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Support')),
body: GtatethChatWidget(
config: const WidgetClientConfig(
baseUrl: 'https://api.g-tateth.com',
tenantDomain: 'your-tenant-domain.com',
),
customer: const ChatCustomer(
firstName: 'Ada',
lastName: 'Okafor',
email: 'ada@example.com',
),
),
);
}
}
Low-level API usage #
final client = WidgetClient(
config: const WidgetClientConfig(
baseUrl: 'https://api.g-tateth.com',
tenantId: 'YOUR_TENANT_ID',
),
);
final session = await client.initSession(sessionId: 'device-session-123');
final messages = await client.getMessages(
conversationId: session.conversationId,
bearerToken: session.token,
);
await client.sendMessage(
conversationId: session.conversationId,
text: 'Hello from Flutter',
bearerToken: session.token,
);
Realtime example #
final realtime = WidgetRealtimeClient(
RealtimeConfig(
baseUrl: 'https://api.g-tateth.com',
token: session.token,
conversationId: session.conversationId,
),
);
await realtime.connect();
realtime.messages.listen((message) {
debugPrint('new-message: ${message.text}');
});
Notes #
baseUrlshould point to your backend API host, for examplehttps://api.g-tateth.com.- If your backend identifies tenants by domain, provide
tenantDomain; otherwise usetenantId. - The SDK is designed to work with the existing widget backend endpoints in this repository.
Local Testing #
Use this SDK from your own Flutter app and point it to your local backend.
- Set:
baseUrlto your local API URLtenantDomain(ortenantId) to a valid tenant
- Run your app on emulator/device and verify:
- App loads chat UI
- Session initializes
- You can send a message
- Incoming agent/chatbot message appears in real-time