W Wiretalk Docs
Developer documentation

Data Lookup

Connect a read-only database, authenticate visitors in the widget, let them search their own records (transactions, status, dates), and power lookup rules for bots and AI.

Dashboard: Widget Settings → Data lookup

Connect your client database so visitors get real answers from your data — order status, account balance, ticket history, and more. Data lookup runs before bot templates and AI.

Wiretalk supports three related capabilities:

  • Lookup rules — match visitor messages to SQL queries and reply automatically
  • Visitor account login — authenticate visitors against a parent account table before sensitive data
  • Filter record search — after login, visitors filter their own rows (txn, UTR, status, date range) in a searchable table UI

Database connection

Security: Use a read-only database user. Wiretalk never writes to your client database through data lookup.
1

Add connection details

Host, port, database name, username, and password. Supports MySQL and other configured drivers.

2

Test the connection

Use the built-in connection test before saving. Config is stored encrypted on your site.

3

Build lookup rules

Define rules that map visitor questions to SQL queries and format the response message.

Lookup rules

Message patterns

Match visitor messages with keywords or patterns. Each rule runs a query and formats the reply.

Joins & filters

Build multi-table queries with joins, WHERE clauses, and column mappings in the visual rule builder.

Row actions

Show paginated results in the widget with clickable row actions (e.g. “View invoice”).

Charts & exports

Return HTML tables, charts, and downloadable exports inside chat replies when configured on a rule.

Visitor account login

Require visitors to prove their identity before Wiretalk returns account-specific data. Login uses your parent resolver table — typically a customers or users table keyed by email or mobile.

1

Enable parent resolver

In Data lookup settings, turn on the parent resolver and choose the parent table plus lookup columns (e.g. email, mobile).

2

Configure visitor account login

Set menu label, confirm prompt ({email} placeholder supported), success reply, and optional visitor suggestion buttons shown after login.

3

Optional email OTP

Enable Require login email OTP to send a one-time code to the matched email. Visitors confirm with POST /api/widget/account-login/verify-otp.

  • Login state is stored on the visitor profile as account_login (logged_in, identifier, verified_at)
  • Rules that scope child rows via a foreign key can require login automatically
  • Visitors can log out from the widget menu — POST /api/widget/account-logout

Filter record search

Let logged-in visitors search their own records without typing free-form chat messages. After account login, a Search your data button appears in follow-up suggestions (or the widget menu).

Requires: Data lookup enabled, parent resolver configured, visitor account login active, and at least one filter-record table mapped in Data lookup → Filter record search.

Dashboard setup

  • Button label — e.g. “Search your data” (shown in chat and filter modal title)
  • Filters — enable presets: transaction ID, UTR, status, mobile, date range
  • Tables — map up to 5 tables with link_column (FK to parent account), filter columns, output columns, and optional masked columns
  • Replies — customize empty-state and login-required messages

Widget behaviour

  • Visitor taps the button → filter form overlay → results render as HTML tables in chat
  • Rows are scoped to the logged-in parent account via link_column
  • Sensitive columns can be masked; results respect the configured row limit (default 20, max 50)
  • On init, public config is exposed as widget_config.filter_record (enabled, filters, labels)

See the Widget data lookup API for request/response details.

Widget experience

Visitors can paginate through lookup result sets, trigger row actions directly in chat, and — when logged in — open the filter record search modal. Demo row-action endpoints are available for testing during setup.

Profile enrichment after login

When a visitor completes account login, Wiretalk reads safe columns from the matched parent database row and fills empty visitor profile fields — name, email, phone, and custom pre-chat fields — without overwriting values the visitor already provided.

  • Recognized name columns include name, full_name, customer_name, or combined first_name + last_name
  • Email and phone columns are matched by common names such as email, user_email, phone, and mobile
  • Other safe columns map to custom pre-chat fields when the field key matches the column name
  • Passwords, tokens, OTPs, and similar sensitive columns are never copied
Tip: Pair visitor login with a pre-chat form so agents see verified contact details even when the visitor skips manual entry. The same profile data pre-fills the Book a demo slot picker.

API endpoints

EndpointPurpose
GET/PATCH /api/agent/data-lookupConfig, connection, filter record settings
GET /api/agent/data-lookup/schemaTable/column discovery
POST /api/agent/data-lookup/preview-ruleTest a rule before publish
GET /api/agent/data-lookup/logsExecution audit log
POST /api/widget/initReturns filter_record and visitor_account_login in widget config
POST /api/widget/account-loginVisitor account login (email/mobile identifier)
POST /api/widget/account-login/verify-otpVerify login OTP when email OTP is enabled
POST /api/widget/account-logoutEnd visitor account session
POST /api/widget/filter-records/searchSearch logged-in visitor records (returns HTML body)
POST /api/widget/data-lookup/paginatePaginate lookup rule results in chat
POST /api/widget/data-lookup/row-actionExecute a configured row action

Full request/response examples: Widget data lookup API reference.