Skip to main content
This guide is for teams who want Text reports they can customize or connect with their own data. It sets up Metabase, a free, open-source BI tool, backed by a Postgres database you control, so every chart is a SQL query you can edit or extend. By the end of this guide, you’ll have a Metabase dashboard showing your team’s reports data, built on a database that’s open to build on further.

Prerequisites

You’ll need:
livechat/text-metabase-integration
Loading repository data...
This guide sets Metabase up and builds the dashboard for you — you don’t need prior Metabase experience to complete it. Familiarity with Metabase (editing questions, adding cards) will help if you want to customize the dashboard afterward.
Use this setup only on your own machine. It stores credentials in a local .env file and doesn’t configure HTTPS. Don’t expose this Metabase instance to the internet or a shared network as-is.

Set up the dashboard

This guide starts a new, local Metabase instance. Three things work together: Text provides the report data, Postgres stores a local copy of it, and Metabase reads that copy and displays the dashboard.
1

Create a personal access token

In Text, go to Settings → API access → Personal access tokens and create a token with the reports_read scope — this is the permission that lets the exporter read report data. No write access is required.Copy the Base64-encoded token value that Text displays — this is your combined account_id:personal_access_token. The exporter uses this directly as your Text API access.
Treat this value like an equivalent to your account’s API password. Don’t commit it or share it outside a secrets manager.
2

Clone the repo and configure the environment

In your terminal, clone the repository and copy the example environment file:
The .env file holds the settings and credentials this local setup needs. Open the file you just created — in any text editor — and set:
Due to Metabase’s password policy, METABASE_ADMIN_PASSWORD must contain at least one digit.
3

Start Postgres and Metabase

In your terminal (still inside text-metabase-integration), run:
This starts Postgres, which stores the exported report data and Metabase’s own settings. It also starts Metabase itself — the dashboard, at http://localhost:3000 — in the background. You can keep using this same terminal for the rest of the steps.
4

Export report data

Run the exporter:
This copies the latest 30 days of first response time, CSAT, and chat-duration data from Text into the local Postgres database. When it finishes, the terminal shows export complete. You can run this command again any time you want to refresh the dashboard.
This creates the report tables on first run. Then it calls three Reports API v3.6 endpoints for the latest 30 days, measured in UTC, and writes the results to Postgres:Each call sends the same request shape to https://api.livechatinc.com/v3.6, with your Basic-auth credential from step 1:
agent_performance and agent_performance_summary are fully replaced on every run. They only ever reflect the latest 30-day window, and they hold no history.chat_ratings and chat_durations work differently — they’re saved by date and updated if that date already exists, so their history accumulates across runs. That’s why the dashboard’s “by agent” card only ever shows a current snapshot, while the daily trend cards build up over time.
5

Complete Metabase's first-run setup

Metabase already has its own database for storing dashboards and settings. This is separate from text_analytics, the database the exporter writes report data into.During first-run setup, complete your initial admin configuration. Metabase will also ask whether you want to add a database — choose “I’ll add my data later”. The next step connects the report data automatically, so adding a database manually here could leave you with a duplicate.Open http://localhost:3000 and step through Metabase’s setup screen using the exact METABASE_ADMIN_EMAIL and METABASE_ADMIN_PASSWORD values from .env.
If you’ve used this local instance before and don’t see the first-run setup screen, reset it with stop or reset.
6

Bootstrap the dashboard

In a terminal, run:
This connects Metabase to the local Postgres database and creates the Text Service Quality dashboard with four cards. When it finishes, the terminal shows dashboard bootstrap complete.
This job signs in with your admin credentials, then:
  1. Finds or creates a Text Analytics Postgres connection pointing at the postgres container.
  2. Finds or creates the Text Service Quality dashboard.
  3. Finds or creates each of four cards on that dashboard, skipping any that already exist — safe to run again after a new export.
The connection details it fills in:Each card is a Metabase question built with SQL, run against the exported tables:
7

View the dashboard

In Metabase, open Dashboards → Text Service Quality.You should see overall first response time, first response time by agent, daily CSAT, and daily average chat duration — assuming your account had chat activity in the last 30 days.

Troubleshooting

Keep the dashboard fresh

The integration does not sync automatically. If you don’t run the exporter again, the dashboard keeps showing the data from the last export:
Run this whenever you want fresh data.
If you want this to happen automatically, schedule the command above to run once per day. A crontab entry is the simplest option:
A scheduled CI workflow can also run the export, but it must use a self-hosted runner that can access the same persistent Docker volumes as the Metabase stack.

Stop or reset

Stop the stack while keeping your data:
Start it again the same way: docker compose up -d. Remove all local data — the exported reports and the Metabase admin account and setup — and start from scratch:

Keep exploring

Reports API reference