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

# Dimensions

> Catalog tables for enriching your fact queries: agents, teams, templates, flows, channels, and flow nodes.

# Dimensions

Dimensions are small catalog tables that describe the entities your facts reference. Fact tables already carry the most common names inline (`agent_name`, `poll_name`, `team_name`…), so you only need a dimension join when you want attributes beyond the name — an agent's email, an HSM's approval status, a node's AI configuration.

## dim\_agents

One row per agent account.

| Column       | Type   | Description                                       |
| ------------ | ------ | ------------------------------------------------- |
| `id`         | Int32  | Agent identifier (joins `agent_id` in facts)      |
| `company_id` | Int32  | Your company (filtered automatically)             |
| `first_name` | String | First name                                        |
| `last_name`  | String | Last name                                         |
| `email`      | String | Agent's email                                     |
| `active`     | Bool   | Whether the agent is currently available (online) |
| `agent_type` | String | Role: `AGENT`, `ADMIN`, or `SUPERVISOR`           |

## dim\_teams

One row per team.

| Column       | Type   | Description     |
| ------------ | ------ | --------------- |
| `id`         | Int32  | Team identifier |
| `company_id` | Int32  | Your company    |
| `name`       | String | Team name       |

## dim\_tags

One row per tag (queue/group inside a team).

| Column       | Type   | Description             |
| ------------ | ------ | ----------------------- |
| `id`         | Int32  | Tag identifier          |
| `company_id` | Int32  | Your company            |
| `name`       | String | Tag name                |
| `team_id`    | Int32  | Team the tag belongs to |

## dim\_agent\_tags

One row per agent–tag assignment — which agents work which queues.

| Column       | Type   | Description      |
| ------------ | ------ | ---------------- |
| `agent_id`   | Int32  | The agent        |
| `company_id` | Int32  | Your company     |
| `tag_id`     | Int32  | The tag assigned |
| `tag_name`   | String | Tag name         |
| `team_id`    | Int32  | Team of the tag  |
| `team_name`  | String | Team name        |

## dim\_hsms

One row per HSM (WhatsApp template).

| Column          | Type   | Description                                                                                                                                                      |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`            | Int32  | Template identifier (joins `hsm_id` in facts)                                                                                                                    |
| `company_id`    | Int32  | Your company                                                                                                                                                     |
| `name`          | String | Template name                                                                                                                                                    |
| `status`        | String | Lifecycle status: `APPROVED`, `PROCESSING`, `REJECTED`, `PAUSED`, `DISABLED`, `ARCHIVED`, `PENDING_DELETION`                                                     |
| `category`      | String | Meta category: `MARKETING`, `UTILITY`, `AUTHENTICATION`, plus legacy categories on older templates (`ACCOUNT_UPDATE`, `ALERT_UPDATE`, `TRANSACTIONAL`, `OTP`, …) |
| `template_type` | String | `TEXT`, `RICH`, or `MEDIA`                                                                                                                                       |
| `content`       | String | Template text content                                                                                                                                            |
| `provider_id`   | String | Meta's template id                                                                                                                                               |

## dim\_polls

One row per flow **version**. When you edit a flow in the editor, a new version (new `poll_id`) is created; `original_poll_id` groups all versions of the same logical flow.

| Column             | Type   | Description                                        |
| ------------------ | ------ | -------------------------------------------------- |
| `poll_id`          | Int32  | Flow version identifier (joins `poll_id` in facts) |
| `poll_name`        | String | Flow name                                          |
| `original_poll_id` | Int32  | Identifier of the flow across versions             |
| `version`          | UInt64 | Version number                                     |
| `hidden`           | Bool   | Whether this version is hidden in the platform     |
| `company_id`       | Int32  | Your company                                       |

<Note>
  To analyze a flow across edits, group facts by `original_poll_id` via this dimension rather than by raw `poll_id`.
</Note>

## dim\_channels

One row per WhatsApp line.

| Column          | Type       | Description                                      |
| --------------- | ---------- | ------------------------------------------------ |
| `company_id`    | Int32      | Your company                                     |
| `channel_id`    | Int32      | Channel identifier (joins `channel_id` in facts) |
| `whatsapp_line` | String     | The line's phone number                          |
| `display_name`  | String     | The line's display name                          |
| `created_at`    | DateTime64 | When the line was created                        |

## dim\_poll\_nodes

One row per node of each flow version — the structure behind [`fact_treble_session_nodes`](/en/docs/data-warehouse-v2/fact-treble-session-nodes). For AI nodes it includes the full AI agent configuration.

| Column                      | Type   | Description                                                                                                                |
| --------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------- |
| `node_id`                   | Int32  | Node identifier (joins `node_id` / `last_node_id` in facts)                                                                |
| `company_id`                | Int32  | Your company                                                                                                               |
| `poll_id`                   | Int32  | Flow version the node belongs to                                                                                           |
| `node_type`                 | String | Node type: `QUESTION`, `AI_TASK_AUTOMATOR`, `AI_AGENT`, `WHATSAPP_FLOW`, `META_EVENTS`, `HELPDESK_INTEGRATION`, and others |
| `question_id`               | Int32  | Question identifier, when the node asks one; `0` otherwise                                                                 |
| `question_text`             | String | The question's text                                                                                                        |
| `question_type`             | String | `OPEN` (free text), `CLOSED` (predefined options), or `AGENT` (hands over to an agent); empty for non-question nodes       |
| `hsm_id`                    | Int32  | HSM template the node sends, if any; `0` otherwise                                                                         |
| `ai_automator_id`           | Int64  | AI agent configured on the node, if any; `0` otherwise                                                                     |
| `ai_automator_name`         | String | AI agent's name                                                                                                            |
| `ai_automator_description`  | String | AI agent's description                                                                                                     |
| `ai_automator_version`      | Int32  | Latest version of the AI agent linked to this node                                                                         |
| `ai_automator_active`       | Bool   | Whether that latest version is active                                                                                      |
| `ai_automator_tools`        | String | Tools enabled for the AI agent (JSON)                                                                                      |
| `ai_automator_instructions` | String | The AI agent's instructions                                                                                                |

## Example: enrich a funnel with node text

```sql theme={null}
SELECT
    f.node_id,
    n.node_type,
    n.question_text,
    uniqExact(f.session_id) AS conversations_reached
FROM fact_treble_session_nodes AS f
LEFT JOIN dim_poll_nodes AS n
    ON n.company_id = f.company_id AND n.poll_id = f.poll_id AND n.node_id = f.node_id
WHERE f.poll_id = {your_poll_id}
  AND f.entered_at >= today() - 30
GROUP BY f.node_id, n.node_type, n.question_text
ORDER BY conversations_reached DESC
```
