Prerequisites
You’ll need:- Docker and Docker Compose v2, to run Postgres and Metabase.
- A Text account with permission to create personal access tokens.
- Git, to clone the example repository.
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.
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.2
Clone the repo and configure the environment
In your terminal, clone the repository and copy the example environment file:The Due to Metabase’s password policy,
.env file holds the settings and credentials this local setup needs. Open the file you just created — in any text editor — and set:METABASE_ADMIN_PASSWORD must contain at least one digit.3
Start Postgres and Metabase
In your terminal (still inside This starts Postgres, which stores the exported report data and Metabase’s own settings. It also starts Metabase itself — the dashboard, at
text-metabase-integration), run: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.How the export works
How the export works
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.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.How the dashboard connection works
How the dashboard connection works
This job signs in with your admin credentials, then:
- Finds or creates a Text Analytics Postgres connection pointing at the
postgrescontainer. - Finds or creates the Text Service Quality dashboard.
- Finds or creates each of four cards on that dashboard, skipping any that already exist — safe to run again after a new export.
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:Automate exports on a schedule
Automate exports on a schedule
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:docker compose up -d.
Remove all local data — the exported reports and the Metabase admin account and setup — and start from scratch:
Keep exploring