KB Lab Bot


    The KB Lab Bot is a working prototype of a Facebook Messenger Bot that allows you to retrieve Dutch cultural heritage masterpieces. The bot is a showcase of an open source content management system that allows you to build your own chatbot. 

    The KB Lab Bot is a result of the Hack-a-LOD 2016. This is a yearly hackathon that focuses on linking cultural heritage collections. The 2016 edition was won by developer Hay Kranen. He built the ‘Erfgoedbot’: a Facebook Messenger bot that gives users access to cultural heritage artefacts, retrieved from Wikidata. 

    Since the KB promotes sustainability of tools developed during the Hack-a-LOD, the first prize was 60 hours of development time by a developer of the National Library of Netherlands (KB). The aim of these available hours was twofold:

    • To bring the winning idea of the Erfgoedbot to the next level: a working prototype of a Facebook Messenger bot, called the KB Lab Bot.
    • To build an open source Content Management System (CMS) called Chatbot Builder, allowing other users to build their own (Facebook) Messenger bots.

    On these pages you can find all information about the working prototype of the KB Lab Bot & the open source CMS. Below we will introduce you on how to use the KB Lab Bot. If you would like to build your own bot with our CMS, please see the ‘Instructions’ tab of this page. Since we were not able to build all features for the CMS, we noted our extra ideas on the ‘Examples’ tab. If you have any general questions about the bot, please share them with us via the ‘Comments’ section.  

    Get started using the KB Lab Bot

    To use the KB Lab Bot, please note you need to have a Facebook account & that the bot operates in Dutch.

    To start using the bot, please follow these steps:

    • Go to the Facebook page of the KB Lab Bot: https://www.facebook.com/KBLabBot/
    • To get connected with the Bot, please click on the button ‘Send Message’. You can find this button on top of the page. Depending on your language settings of Facebook this text could also be in your native language. In Dutch this is 'Bericht versturen'. The button looks like this:


    • You will now see a small popup at the bottom of your screen. Please click on the button ‘Get started’. Depending on your Language settings of Facebook this text could also be in your own language (e.g. ‘Aan de slag’ for Dutch). 
    • From this point onwards, the KB Lab Bot will start chatting with you. When you run this for the first time, the bot explains what you can expect and how you can use & configure it. 
    • Please note: if you have problems getting the bot started via the Facebook page, you can also activate the bot instantly via m.me/kblabbot. On that screen you can find the 'Get started' button at the bottom of the page.


    The KB Lab Bot currently allows you access to a selection of images that are available on the website ‘Geheugen van Nederland’ [Memory of the Netherlands]. This website is a database containing paintings, drawings, photographs, sculptures, ceramics, stamps, posters and newspaper clippings from more than a hundred Dutch museums, archives and libraries. The KB Lab Bot only shows images of collections that are copyright-free. 

    The KB Lab Bot features the following functionalities:

    • Daily Image: You can ask the bot to send you an image of the Memory of the Netherlands on a daily notice. Once you clicked on ‘Send Message’ for the first time, you will get a welcome message of the Bot. After several messages, the bot asks if you would like a daily image and at what moment of the day. Please note, you can always stop this daily notice after you received a new update.
    • Surprise me: If you would like to be surprised by an image of the Geheugen van Nederland, please type ‘verras me’.
    • Search: If you would like to search for an image please type the word ‘zoek’ followed by the word you’re searching for. For example: zoek Den Haag 
    • Feedback: We would love to hear what you think of our Bot. If you type the word ‘feedback’ you will be informed on how to provide us with your feedback.
    • Help: If you need any help on using the bot, simply type in the word ‘help’. You will be given an overview of all the commands you can use to chat with the KB Lab Bot.


    Please find a short overview of all the commands you can use to chat with the KB Lab bot:

    • Verras me = Be surprised by a random image of the Geheugen van Nederland
    • Zoek … = Search for an image by typing in the word 'zoek' followed by the words you are looking for
    • Feedback = Provide feedback on your experience with our bot
    • Help = get a list of all commands to communicate with our bot
    Commando's gif

    When citing the KB Lab Bot, we request you to cite it as follows:

    Ark, R. van der, Kranen, H., Kleppe, M., Lucas, A. (2017), KB Lab Bot. KB Lab: The Hague:  http://lab.kb.nl/tool/KB-Lab-Bot


    The KB Lab Bot has been set up with two components: 1) the Chatbot Builder and 2) A Webhook. 

    The Chatbot Builder is an open source Content Management System that we built and runs on our server.  It allows you to build dialogs with the users of the bot. For instructions on how to install the Chatbot Builder on your own server & how to build dialogs, please see below. 

    The Chatbot Builder already allows you to build a proper bot that can be used to create a Facebook Messenger or chatbots in other platforms such as your own website. However, if you want your users to be able to request information that is located elsewhere, you will need to build a webhook.  A webhook allows you to give custom callbacks on your website or in this case by a bot. Facebook has extensive documentation on how to set-up your own webhook, see this page. We built our own webhook that is connected to the website ‘Geheugen van Nederland’ [Memory of the Netherlands].

    How to build your own chatbot using our code

    To build your own chatBot we made an open source Content Management System, called the Chatbot Builder. When building this, we were inspired by other chatbot tools such as chatfuel. This code can be used to build a Facebook Messenger bot but is applicable to all sorts of platforms. You could e.g. modify it to build an embedded chatbot widget within your own website. We published our code and documentation on how to install the Chatbot Builder on your computer at Github: https://github.com/KBNLresearch/chatbot-builder-nl. Please note all instructions on the Github page are in Dutch. We are working on an English translation. 

    How to configure your dialog in the Chatbot Builder

    Once you installed the Chatbot Builder on your computer or server, you are ready to start building your own dialogs. Depending on your set-up you will need to log in either in mock modus or with your Facebook account. Once you’re in, you will see the following features:

    • Chatbot testen - Open Emulator: this is a built-in Emulator allowing you to test your dialogs
    • Welkomstboodschap - Instellen: With this feature you can set up a Welcome message
    • Dialogen: This allows you to build the dialogs your bot will have with its users. Please find more info on how to set-up these dialogs below.
    • Import/Export: This allows you to import or export the dialogs you built. Once you export your dialogs, you will download your datamodel as JSON. You can validate the export by using e.g. https://jsonlint.com/

    The most important feature of the Chatbot Builder is building dialogs. You can do this by following these steps:

    • Click on ‘Voeg een dialoog toe’ [‘Add a dialog’]
    • Type in what your user might say to the chatbot and click on ‘Voeg een dialoog toe’ [Add a dialog].
    • In the next screen, on top you will see the words you typed in. When the words have a blue background, this means the Chatbot Builder will use some Natural Language Processing techniques to recognize the words. When you programmed your bot to e.g. recognize the word ‘Goedendag’ [Goodday], the NLP add-on makes sure the bot also recognizes typos in the word or derived words such as ‘Goedemorgen’ [Good morning] or ‘Goedenmiddag’ [Good afternoon]. For this feature, we used Clips. If you do not want the Chatbot Builder to use this feature, please click on the word and the background will turn into red. 
    • The next step is adding a reply of the bot. Please click on ‘Voeg een antwoord toe’ [Add a reply].
    • You can then choose six types of replies the bot can send: Tekst [Text], Knoppen [Buttons], URL, Webhook, Afbeelding [Image] or Aan het typen [Typing].  Please select one and then the ‘Vertraging ‘ [time of delay]. Since a bot mimics human behaviour, we advise you not to send the answer straight away but build in some time before the answer will be shown. Depending on the type of answer you chose, you can add the answer the bot should give.

    If you now want to test whether the bot functions properly, please click on the ‘Open emulator’ button at the left. You can then type in the words that should trigger the dialog and check whether it functions properly.

    For a quick overview on how to set-up dialogs, please see this short gif:

    Dialog builder

    How to configure Facebook to start using your bot

    The next step is to get your bot up and running. To do this, you will first need a Facebook Developers account which you can set up at https://developers.facebook.com/. You can then add a new app. Once you are in your app dashboard, please add two products on the bottom of the navigation bar: 1) Messenger, and 2) Webhooks.

    The following steps can be found at the Facebook documentation section that offers extensive documentation on how to get your bot activated: https://developers.facebook.com/docs/messenger-platform/getting-started 

    How to bring users to your bot

    We have been puzzling quite a while on the entry point to our bot. The Facebook Documentation gives some good advice on entry points and we closely looked at the bots of Dutch Media outlets such as NOS Update & NRC Update. We decided to follow their approach by setting up a dedicated Facebook Page for the KB Lab Bot: https://www.facebook.com/KBLabBot/ This allowed us to set up and test our bot via the ‘Send Messages’ button. Please note that before you go live you will need to have your bot reviewed by Facebook via your Developers account. The review process might take a couple of working days. In our case, the bot was approved within 1 day.


    Since we had 60 hours of development time available, we could not build everything we wanted in the open source CMS. However, in a backlog of the Chatbot Builder we did keep track of features we would have loved to incorporate. We sincerely hope the community will pick up this backlog and builds on the code we have made available on Github

    Until now, we have identified the following possible additional features:

    • Persistent Menu: Facebook Messenger allows users access to a menu that brings them directly into top-level features of the bot. For more information see the Facebook documentation on persistent menus
    • Likes per post: Users can respond to your Bot’s replies by liking them, disliking them, etc. As Facebook page administrator, you will be able to see all individual chats and replies. However, for analytical purposes it could be helpful to export all replies at once. In our case it would e.g. allow us to analyse which images were most liked or disliked.
    • An export of all chats would be useful to analyse how users interact with your bot. We could e.g. be interested in the types of query terms used to see if we can discover recurring interests.
    • Languages: so far, the Chatbot Builder is built in Dutch. Since we only use a few words, we think non-Dutch speakers can also use the Chatbot Builder. However, a translation of the buttons into English would help even more users.
    • Push messages: At this stage, the Chatbot Builder only allows you to respond to a message of a user. However, some bots also push messages as instructed by their administrators.
    • Installationscript: At this point users need to have some basic programming skills to get the Chatbot Builder up and running. We think an installation script would be helpful to get it started in a smoother way.

    Additionally we also created a backlog for the webhook we built:

    • Image carrousel: When users search for images within the KB Lab Bot, you will get three results shown in a scrollable carrousel.  These images show a small fragment of the complete image. Until now we did not manage to show the complete image but only the top left corner. In some cases, it is very unclear what the image is giving unclear feedback to our users.
    • Metadata: When users search for image, they do not receive metadata with the images shown. When we do show some metadata this could give our users some information on why these images were retrieved.