Data Sources
Connect a database or external HTTP APIs for live AI answers.
The Data Sources module lets your chatbot answer questions using live data—either from a connected MySQL/MariaDB or PostgreSQL database or from your own HTTP APIs. In billing and entitlements the module is still keyed as Database; in the product UI it appears as Data Sources under Automation.
Where to configure
Open Automation in the sidebar, then the Data Sources tab (?tab=database). The tab appears only when the module is entitled on your subscription.
On first visit you choose a mode:
| Mode | Best for |
|---|---|
| Database connection | Direct read-only SQL against your MySQL/MariaDB or PostgreSQL (catalog, orders, inventory in your DB) |
| External APIs | Data already exposed by your REST APIs (order status, CRM lookups, custom backends) |
You can switch modes later with Change data source; saved database and API configurations are kept but only the active mode is used in chat.
A status banner at the top shows Ready when configuration is complete, or explains what is still missing (for example no enabled tables or no API endpoints).
Database mode — five-step wizard
Database mode uses a numbered wizard. Later steps stay disabled until earlier prerequisites are met.
| Step | Tab | Purpose |
|---|---|---|
| 1 | Connect | Database credentials, connection test, save, disconnect |
| 2 | Import | Discover tables and columns from your database |
| 3 | Curate | Enable tables/columns, access modes, AI descriptions, training settings |
| 4 | Preview & Test | See the schema document the AI receives and test natural-language questions |
| 5 | Activity | Query history, guard outcomes, and errors |
Connect
Enter credentials for your database:
- Provider — MySQL (including WooCommerce/WordPress stores) or PostgreSQL
- Host, port, database name, username, and password
Use a read-only database user when possible. The AI only runs SELECT queries, but a read-only account adds a second layer of safety.
Test connection before saving. After a successful save, continue to Import. You can Disconnect database later to remove the connection and wipe schema settings for this chatbot.
Import
Run Import schema (or Re-import schema after database changes) to discover tables, columns, row counts, sample values, and foreign-key relationships. Re-import preserves your existing table and column settings where possible.
For each discovered table you can enable or disable it for AI queries. Enabling a table automatically allows all columns if none were previously selected.
If the database looks like a WooCommerce store, a banner offers Apply WooCommerce preset, which configures curated tables, access modes, relationships, and AI descriptions for common store data (including HPOS order tables where present).
Curate
For each enabled table:
- Access mode — PUBLIC (any visitor) or PERSONAL (scoped to a verified customer)
- Identity scope column — for personal tables, the column that holds the customer's email (for example
billing_emailon orders) - AI description — optional context at the table and column level so the model understands your schema
- Column allow list — toggle individual columns on or off separately from the table enable switch
Review relationships between tables (discovered automatically, from presets, or added manually in the backend).
Use Generate AI descriptions to draft table and column descriptions from your schema (requires an admin-configured AI model for the Database module).
About this data
At the bottom of Curate, the About this data card holds training settings that are injected into the AI's instructions alongside the schema:
- Purpose — what this data represents (for example "Our online store's product catalog and customer orders")
- Instructions — rules such as currency, tone, or what to prioritize
- Max rows per query — limit between 1 and 100 (default 25)
- Personal data verification — how customers prove identity before personal tables are queried:
- Email + 6-digit code — full access after OTP verification
- Order number + email — scoped to a single order without a code; specify the Order ID column matched against the customer's order number
Save curation and training before moving to Preview & Test.
Preview & Test
Two panels help you validate setup before going live:
- What the AI sees — the schema document included in the system prompt
- Test a question — ask a natural-language question and inspect the answer plus generated SQL
Dashboard tests bypass personal-data scoping so you can validate SQL generation; live chat still enforces identity rules on personal tables.
Activity
Query activity shows the last 25 database queries for this chatbot: success or failure, row counts, channel, identity-scoped badge, AI intent, generated SQL, guard block codes (for example identity required), and error messages. Refresh or clear the log from this tab.
External API mode
When you choose External APIs, configuration uses two tabs:
| Tab | Purpose |
|---|---|
| Configure APIs | Add, list, and delete HTTP endpoints |
| Test | Run a sample question through the full tool loop |
For each endpoint provide:
- Name — used to build the AI tool name (
call_api_{name}) - URL template — for example
https://api.example.com/orders/{orderId} - HTTP method — GET or POST
- Description — tells the AI when and how to call the endpoint
- Auth header (optional) — stored encrypted
The assistant calls these endpoints instead of SQL. Chatloop validates URLs (HTTPS/HTTP only, blocks private/local addresses) and caps response size and timeout.
API mode is ready when at least one enabled endpoint exists. API call logs are stored internally but are not yet shown in the UI.
Security notes
- Only enable tables, columns, or API endpoints the assistant truly needs.
- Use PERSONAL access mode and identity verification for sensitive database rows.
- Protect API endpoints with authentication headers where appropriate.
- Rotate credentials if they may have been exposed.
Permissions
Configuring Data Sources requires settings-level access on the chatbot (owner or team admin). The Automation sidebar item is hidden from read-only team members unless they have calendar-specific access.