How to add a ChatGPT chatbot to Koha
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.
- 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
-
Log into your Koha account as administrator (or teacher/staff with admin privileges) and select Tools from the menu list
-
Select HTML customizations from the list of Tools under Additional tools
-
Select OPACUserJS under Additional content: HTML customizations
-
Select Click to edit
-
Insert the modified script snippet in the Value text box and click on Save all OPAC preferences
-
Your chatbot button will now be displayed on your Koha library website pages
-
If you click on the button it will display the chatbot dialogue
Your chatbot is now added to your Koha library website and your visitors/patrons can start interacting with it!
Not finding what you need? Reach out to our support team for help.
Contact Support