> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Treble AI as a data source

> Bring data from Treble AI to Nekt.

Treble AI is a conversational AI platform that helps businesses automate customer interactions and manage conversations at scale. It provides tools for creating and managing automated conversations, tracking customer interactions, and analyzing conversation data.

<img width="25%" src="https://mintcdn.com/nekt/ofvGjfftxTX_lnNR/assets/logo/logo-treble-ai.jpg?fit=max&auto=format&n=ofvGjfftxTX_lnNR&q=85&s=c2e87070e7ccea9191e048ee65affb4f" data-path="assets/logo/logo-treble-ai.jpg" />

## Configuring Treble AI as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the Treble AI option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

You'll need to provide the following credentials to connect to Treble AI:

* **API key**: The token to authenticate against the API service. Check [this resource](https://help.treble.ai/en/api-reference/intro/api-key#how-to-obtain-an-api-key%3F) for more info on how to generate the token.

Additionally, you can configure:

* **Lookback window**: The number of days to look back when fetching session history. This is important to ensure new replies are fetched after the session creation date.
* **Start date**: The start date from which you want to start syncing records.

Once this is done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync - you can select all streams or pick specific ones that matter most to you.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select a name for each table (which will contain the fetched data) and the type of sync.

* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** and make this process faster!

* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data - which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data - which is good if, for example, you don't want to have deleted data in your catalog.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can determine when to execute a [full sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync). This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

<Warning>For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.</Warning>

# Streams and Fields

Below you'll find all available data streams from Treble AI and their corresponding fields:

<AccordionGroup>
  <Accordion title="Conversations">
    Stream for managing conversation flows and polls.

    **Key Fields:**

    * `id` - The conversation's system ID (Primary Key)
    * `name` - The conversation's name
  </Accordion>

  <Accordion title="Sessions">
    Stream for tracking individual conversation sessions.

    **Key Fields:**

    * `id` - The conversation's unique identifier (Primary Key)
    * `poll_id` - The poll's unique identifier
    * `created_at` - When the conversation was created
    * `finished_at` - When the conversation was completed

    **User Information:**

    * `user` - Information about the conversation participant:
      * `country_code` - User's country calling code
      * `cellphone` - User's phone number
  </Accordion>

  <Accordion title="Session History">
    Stream for detailed message history within sessions.

    **Key Fields:**

    * `_id` - The unique identifier for the message (auto-generated by the connector)
    * `session_id` - The conversation's session identifier
    * `type` - The type of message
    * `timestamp` - The timestamp of the message

    **Message Details:**

    * `message` - Detailed message information:
      * `type` - The message type
      * `sender` - Who sent the message
      * `text` - The message text content
      * `file_url` - URL to any attached file
      * `created_at` - Timestamp when message was created
      * `delivered_at` - Timestamp when message was delivered
      * `read_at` - Timestamp when message was read
      * `extra` - Additional message metadata
  </Accordion>
</AccordionGroup>

## Data Model

The following diagram illustrates the relationships between the core data streams in Treble AI. The arrows indicate the join keys that link the different entities.

```mermaid theme={null}
graph TD;
    subgraph "Core Entities"
        Conversations("Conversations");
        Sessions("Sessions");
        SessionHistory("Session History");
    end

    Sessions -- "poll_id" --> Conversations;
    SessionHistory -- "session_id" --> Sessions;
```

## Skills for agents

<Snippet file="agent-skills-intro.mdx" />

<Card title="Download Treble AI skills file" icon="wand-magic-sparkles" href="/sources/treble-ai.md">
  Treble AI connector documentation as plain markdown, for use in AI agent contexts.
</Card>
