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

The Opensolr Chat Bot answers your visitors from your Opensolr Index: the pages Opensolr crawled 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: every answer uses AI requests from the monthly allowance 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 your visitors get

Your visitors ask. Your site answers.

Every question is searched in your Opensolr Index and answered from what that search finds: word by word, in the visitor’s language, with a link for every page, product and PDF page it uses; the sources at the end of an answer show as small pills. The chat is the same one Opensolr hosts for you, so its answers and commands are explained once: What your visitors see · Chat bot commands.

In the chat window

A button at the bottom right of your pages opens it.

  • Your logo, words and colour: title, button text, greeting and one accent colour.
  • Commands one keystroke away: typing / lists them, the ? button explains each one.
  • A conversation that is kept in the visitor’s browser, across reloads, until New chat.
  • Resizable on a computer, full screen on a phone.

Behind it, on your server

Visitors talk only to your site.

  • Your Opensolr email and API key stay on your server and never reach a browser.
  • A captcha before the first question, if you turn it on.
  • Limits you set: message length, questions per conversation and per visitor.
  • An admin in seven languages: English, Română, Français, Deutsch, Español, 中文 and 日本語.
Three ways to have this chat. On your own PHP site (this page), hosted by Opensolr with one line of code (Hosted Chat Bot), or hosted on every page of a Drupal or WordPress site with one switch. Compare the three
02 The admin

Stats, history and seven settings 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. The admin, step by step

Page or tabWhat you find there
StatsMessages, conversations, visitors, answer rates, ratings and what people search for.
HistoryEvery conversation of the last 30 days, searchable, readable as the visitor saw it.
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 windowTitle, button text, greeting, placeholder, logo and 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 language of the admin, one of seven.
Add to your pagesThe script tag to paste into your pages, and the two attributes that tell the chat who is signed in.
03 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.
04 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 Opensolr or sent with Data Ingestion. The chat answers from that index and nothing else. Enterprise Site Search explains both.

AI requests

Every answer uses AI requests. The free plan and every current plan include a monthly allowance (500 a month to start), and a bigger one is an AI tier on Pricing. What you have and what is used: API Quota.

05 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.
06 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 with the AI requests of your plan: create an account or see the plans.