A chatbot for your website. It answers from your own content.

The Opensolr Chat Bot answers your visitors from your Opensolr Index: the pages the Opensolr Web Crawler fetched from your site, or what you sent with Data Ingestion. Each answer is written as it comes, with links to the pages, the products and the exact PDF pages it used.

Free and open source under the MIT license. PHP 8.1 or newer, SQLite, no framework, no separate virtual host. It needs an Opensolr account whose plan includes AI: every answer uses the AI requests of your plan. Try it on this page: the chat at the bottom right is the Opensolr Chat Bot, answering from the Opensolr Index of opensolr.com.

  1. 01

    Install it on your site

    One Composer package and one small PHP file, on one path of your own site.

  2. 02

    Connect your Opensolr Index

    In its own admin page: your Opensolr email, a scoped API key, and the index it answers from.

  3. 03

    Add one script tag

    The chat button appears at the bottom right of every page that has it.

  4. 04

    Your visitors ask

    In their own words and their own language, and get answers from your content, with links.

YOUR VISITORasks in their own words,in any languageYOUR SITEone path of your own site,keeps your API keyYOUR OPENSOLR INDEXsearched for every question:pages, products, PDF pagesTHE ANSWERwritten word by word,linked to what it used
Your indexAnswers only from your own Opensolr Index
Word by wordWritten as it comes, with a line saying what it is doing
1 script tagOn any site, served from one path of your own
MIT licensedEvery line on GitHub, installed with Composer
01 What it does

Your visitors ask. Your site answers.

Every question is searched in your Opensolr Index, and the answer is built from what that search finds, with a link for every page, product and PDF page it mentions.

Answers from your content

For every question it searches your site, answers only from what it finds, and links every page and product it names. Products come with their prices, and a PDF opens at the exact page.

Written as it comes

The answer appears word by word, so nobody stares at an empty window. Until the first word, one line says what it is doing: Searching for…, Reading the document…

It knows what day it is

Today’s date in your time zone, so it can look for the latest on a subject, or for what was published in a period.

In your visitor’s language

Every visitor is answered in their own language. The admin, for you, is in seven: English, Română, Français, Deutsch, Español, 中文 and 日本語.

Commands that answer at once

/search, /time, /rate, /vat, /vatcheck, /distance, /place, /postal, /ip, /language and /translate, in a list that opens as soon as a visitor types /.

Your key stays on your server

Your Opensolr email and API key are kept on your server and never sent to a browser. Visitors talk only to your site, behind a captcha and limits you set.

02 The chat window

A chat window built for people.

A button at the bottom right of your pages opens it. It sits apart from your page’s styles, takes your page’s font, and looks the way you set it in the admin.

Your logo, your words, your colour

The title, the text of the chat button, the greeting, the placeholder, your logo on the button and in the header, and one accent colour for the button, the header and the links.

It shows what it is doing

A line under the question says what the assistant is doing, until the first words of the answer arrive. The window follows the answer down, and stays put for a visitor who scrolls up to read.

Links open in a new tab

A visitor who opens a page, a product or a PDF page from an answer keeps the conversation where it was.

A conversation that is kept

In the visitor’s browser, across reloads, pages and tabs of your site. New chat starts over, and Arrow Up and Arrow Down bring back the messages sent before.

Commands, one keystroke away

Typing / lists the commands as you type. The ? button explains each one, with an example to click, and a table of language codes for /translate.

Resizable, and full screen on phones

On a computer the window is resized from its corner, and remembers its size. On a phone it fills the screen.

One question at a time, within your limits

A captcha before the first question, if you turn it on. Questions per visitor in a time window, questions per conversation, and the length of a message, all set in the admin.

03 The admin

One page, seven tabs, on your own site.

At /opensolr-chat/admin on your site, behind a password you set on the server and, once you add reCAPTCHA keys, a captcha before it opens.

TabWhat you set there
AccountYour Opensolr email and API key. Test connection lists your indexes; you choose the one the chat answers from.
AssistantYour own instructions for the assistant, and its time zone.
Chat windowThe title, the text of the chat button, the greeting, the placeholder, your logo and the accent colour.
LimitsCharacters per message and per text to translate, questions per visitor in a time window, questions per conversation.
CaptchaYour reCAPTCHA v2 keys, and how many hours a solved captcha lasts.
LanguageThe admin in English, Română, Français, Deutsch, Español, 中文 or 日本語.
Add to your pagesThe script tag to paste into your pages.
04 Where things are kept

Your credentials stay home.

On your server

In one SQLite database, in a folder outside your web root.

  • Your Opensolr email and API key. Use a scoped key made only for the chat, limited to its index.
  • Your settings, your logo and the admin password, the password only as a hash.
  • The counters behind the limits: a keyed hash of each visitor’s IP address, never the address itself, deleted as they expire.

In the visitor’s browser

And nowhere else.

  • The conversation, its last 100 messages, until New chat.
  • The size of the window they chose.
  • A solved captcha, in a cookie, for the hours you set.
Your server talks to two places, and only two: Opensolr, for the answers and the commands, and, with the captcha on, Google, to check a solved captcha.
05 What you need

A PHP site and an Opensolr Index.

A PHP site

PHP 8.1 or newer with pdo_sqlite, curl, json and mbstring, Composer, and Apache or nginx. No MySQL, no framework, no build step.

Your site in an Opensolr Index

Crawled by the Opensolr Web Crawler or sent with Data Ingestion. The chat answers from that index and nothing else.

A plan that includes AI

Every answer uses the AI requests of your plan. See the plans; how many requests you have, and how many are used, is on API Quota.

06 Install

Six steps, a few minutes.

  1. Install the packageWith Composer, in your project folder.
  2. Create a data folderOutside your web root, owned by the user PHP runs as.
  3. Mount it on one pathCopy the front controller and its .htaccess from the package into a folder of your web root, opensolr-chat. nginx takes two location blocks instead.
  4. Set the admin passwordWith one command, run as the user PHP runs as.
  5. Connect your accountOpen /opensolr-chat/admin, enter your Opensolr email and API key, click Test connection and choose the index.
  6. Add the script tagBefore </body> on your pages. Every step in full is on Installing.
# 1. The package composer require opensolr/chat-bot-client # 2. A data folder outside the web root, for the user PHP runs as sudo mkdir -p /opt/opensolr-chat sudo chown www-data:www-data /opt/opensolr-chat # 3. The front controller and its .htaccess, on one path of your site mkdir -p public/opensolr-chat cp vendor/opensolr/chat-bot-client/examples/public/opensolr-chat/index.php public/opensolr-chat/ cp vendor/opensolr/chat-bot-client/examples/apache.htaccess public/opensolr-chat/.htaccess # 4. The admin password, as the user PHP runs as sudo -u www-data php vendor/bin/opensolr-chat-bot password /opt/opensolr-chat
<script src="/opensolr-chat/widget.js" defer></script>
Answers should arrive word by word. If they show up all at once at the end, your web server or a proxy in front of it is holding them back. Streaming through your server has the exact lines for Apache with PHP-FPM and for nginx.
07 Open source

Every line is on GitHub.

The Opensolr Chat Bot Client is MIT licensed: read what it sends where, change it, or fork it and make it yours.

Source code

PHP for the server, plain JavaScript for the chat window. github.com/phpcip/opensolr-chat-bot-client

Composer package

composer require opensolr/chat-bot-client, and every version on Packagist.

Documentation

Installing, the admin, every setting, the commands, streaming, updating and troubleshooting. Read the documentation

Open source

The Opensolr Chat Bot Client is free, MIT licensed and maintained in the open. Browse the code, open an issue, or sponsor the work that keeps it current.

Let your visitors talk to your site.

Free, open source, on your own server, answering from your own Opensolr Index. It needs an Opensolr account whose plan includes AI: create an account or see the plans.