Python

Installation

To install the ConnectFramework Python SDK, use the following command:

pip install connectframework

Usage

Before using any functions, initialize the SDK with your API key.

Initializing the SDK

from connectframework import ConnectFramework

# Initialize the SDK with your API key
ConnectFramework.initialize(api_key="your_api_key_here")

User Authentication

Logging in with a Unique ID and Email

Logs in the user using a unique ID and an email. If unique_id is None, a new one is generated automatically. Returns true if email was accepted and an OTP code was sent to the email.

ConnectFramework.login(unique_id=None, email="[email protected]")

Submitting an OTP Code

If the login process requires an OTP (One-Time Password), this function submits the OTP code for verification.

Logging Out

Logs out the user entirely.

Checking if User is Connected

Returns True if the user is logged in and running the Connect.ai desktop client.


Analytics Tracking

Logging an Event

Logs an analytics event with a category and action.

Logging an Event with Additional Data

Logs an analytics event with a category, action, label, and numerical value.


Summary

Method
Description

initialize(api_key: str)

Initializes the SDK with an API key.

`login(unique_id: str

None, email: str, callback: Callable[[bool], None])`

submit_otp(email: str, otp_code: str, callback: Callable[[bool], None])

Submits an OTP code for verification.

logout()

Logs out the user.

is_connected() -> bool

Returns True if the user is logged in and running the Connect.ai client.

log_event(category: str, action: str)

Logs an analytics event with a category and action.

log_event_with_details(category: str, action: str, label: str, value: float)

Logs an analytics event with additional details.

For more details, refer to the official API documentation.

Last updated