Get Started
Get started
The Future AI SDK provides a WebSocket-based session-like system for real-time communication with the Future AI platform. It processes email content using AI to extract valuable insights about user interests and meaningful contacts.
Install
Prerequisites
- Future AI API Key
- Node.js environment
- Access to Future AI services
API key & SDK configuration
To get started, you need to login to your account on FutureAI and create a new Api key. You will get an API key, and the necesery config to authenticate your requests.
Quickstart
Configuration Options
Parameter | Type | Required | Description |
---|---|---|---|
apiKey | string | Yes | Your Future AI API key |
iframeUrl | string | Yes | URL for the Future AI iframe interface |
serverUrl | string | Yes | Base URL for REST API endpoints |
websocketUrl | string | Yes | WebSocket server URL |
onSessionUpdate | function | Yes | Callback for session state updates |
auth | object | No | Authentication configuration |
onError | function | No | Error handling callback |
Authentication flow
1. Initial connection
2. Google OAuth2 Authentication
3. User Authentication
4. Email Analysis Results
Future Button Implementation
Adding the Button
Error Handling
Error Response Cases
Invalid API Key
Missing API Key
Invalid Authentication Token
Internal Server Error
Implementation Example
Results Structure
Best Practices
- Always handle session updates through the onSessionUpdate callback
- Implement proper error handling using the onError callback
- Store and manage user tokens appropriately
- Handle reconnection scenarios
- Validate configuration before initializing
- Implement proper cleanup on errors