For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK APIs

Sentiance Insights is available through the APIs exposed by the Sentiance SDK for:

  • iOS

  • Android

  • React Native

  • Flutter

Fetching Insights

Depending on your use-case and the technical design of your application, you have two options to retrieve insights:

  1. Querying the SDK on Demand

  2. Listening to Callbacks for Real-time Updates

Querying the SDK on Demand

You can query the SDK for insights at any point in your application logic. The following example demonstrates how to fetch the recent timeline events:

let currentDate = Date()
let calendar = Calendar.current
let fiveDaysAgo = calendar.date(byAdding: .day, value: -5, to: currentDate)

let events = Sentiance.shared.getTimelineEvents(from: fiveDaysAgo!, to: currentDate)
events.forEach { event in
    print(event.eventId)
}

Similarly, you can request various insights. Read through the full example and explore SDK API Reference for a comprehensive list of available APIs

Listening to Callbacks for Real-time Updates

When setting up callbacks for real-time updates, it's crucial to ensure that you attach the listener at the appropriate location in your code.

The listeners should be included in the app boot-up scripts, right after executing the SDK initialization commands.

Checkout Real-Time Listeners for more details

Synchronising Insights with Your Backend

A common practice involves ensuring the insights are effectively synchronised with your backend storage systems. This step is essential for integrating real-time data insights directly into your data management workflows.

Checkout Data Synchronization for more details

Last updated