Back to Installing Your Chatbot

How to add a ChatGPT chatbot to Koha

How to add your custom ChatGPT trained chatbot to your Koha library website.

You want to embed your custom trained chatbot in your Koha library website OPAC pages. Here's how to add ChatGPT to Koha with SiteSpeakAI.

  • A bit of information:

OPAC stands for Online Public Access Catalog, which is an online database of materials held by a library or group of libraries. All references to OPAC means this is what the online user (visitor or registered patron) will see, thus when you add the chatbot to the OPAC preferences, it will be available on all the pages displayed for online users.

Add your chatbot to your Koha website

In SiteSpeakAI

Select your chatbot from the dropdown menu at the top, click on the Install Chatbot section in the sidebar and then click on the Copy Code button to copy your code snippet. 0 - Koha library - Copy JS Code.png

  • Please note:

Koha doesn't allow the standard SiteSpeakAI snippet to be added to the OPACUserJS value, we will have to modify the script to exclude any comments as well as the <script>...</script> tags.

a. Copy the script snippet into your favourite editor and remove the following lines.

i. At the start of your script remove:

<!-- SiteSpeakAI - Add ChatGPT to your website -->
<script type="text/javascript">

ii. At the end of your script remove:

</script>
<!-- / SiteSpeakAI -->

b. This will then end up as follows (if you reformat the lines in the snippet):

(function(){
	d=document;
	s=d.createElement("script");
	s.src="https://sitespeak.ai/chatbots/url.js";
	s.async=1;
	d.getElementsByTagName("head")[0].appendChild(s);
})();

c. We will use this modified snippet when we insert it as Custom HTML to display the chatbot button/dialog.

In Koha

  1. Log into your Koha account as administrator (or teacher/staff with admin privileges) and select Tools from the menu list 1 - Koha library - Select Tools.png

  2. Select HTML customizations from the list of Tools under Additional tools 2 - Koha library - Select HTML customizations.png

  3. Select OPACUserJS under Additional content: HTML customizations 3 - Koha library - Select OPACUserJS.png

  4. Select Click to edit 4 - Koha library - Select Click to edit.png

  5. Insert the modified script snippet in the Value text box and click on Save all OPAC preferences 5 - Koha library - Insert snippet and save preferences.png

  6. Your chatbot button will now be displayed on your Koha library website pages 6 - Koha library - Chatbot button.png

  7. If you click on the button it will display the chatbot dialogue 7 - Koha library - Chatbot dialog.png

Your chatbot is now added to your Koha library website and your visitors/patrons can start interacting with it!

Need more help with SiteSpeakAI?

Not finding what you need? Reach out to our support team for help.

Contact Support

Ready to automate your customer support with AI?

Join over 150+ businesses, websites and startups automating their customer support with a custom trained GPT chatbot.