Robot

How to use RiveScript as chatbot language for user dialogues?

Employees are already sending text messages to their colleagues to exchange information. Therefore, they use Instant messengers such as Facebook Messenger, Telegram and Threema. Is there also a better way for users to get information immediately if the colleague is not available? The answer is yes! For this you need a conversation interface with a chatbot backend. Thanks to RiveScript, the creation of a chatbot does not require any complex AI techniques. Instead, you can write a chatbot in the text editor like Notepad to give simple answers.

What is RiveScript?

RiveScript is a text-based scripting language meant to aid in the development of interactive chatbots. It’s a plain text, line-based scripting language with objectives of being simple to learn, quick to type, and easy to read and maintain. This is in contrast to other chatbot languages that require you to read and write complex XML code (like AIML), or memorize lots of random symbols and “line noise” to write and read your code (like ChatScript).

How to create your own RiveScript chatbot?

To write your own RiveScript code, you will only need a simple text editing program. You can use Notepad for Windows, or gedit for Linux, or any other text editors you have available. A RiveScript document is a text file containing RiveScript code. These files will have a .rive extension. An example file name would be helloworld.rive.

HelloWorld-Example:

+ hello bot
- Hello, User

Now, run the RiveScript interpreter on that file and at the prompt, type “Hello bot” and press Enter. The bot should respond with “Hello, User!“. It’s simple, right?

We have compiled some Java examples that show you how easy it is to use RiveScript on the Business Bot platform. The code examples as follows:

  1. Hello World (The first program)
  2. Wildcards (To find a string or number and reuse it)
  3. Alternations (Alternative answer to the same question)
  4. Random Replies (Giving random answers)
  5. Arrays in Triggers (Giving randomly selected answers from a series of answers)
  6. Topics (Assignment of triggers, only within a topic)

The best way to start is with the examples from the Java project, which you can download here (BusinessLogic.GM.HelloRiveScript.v1.zip / ~10 MB). Now import the Java project into the Eclipse development environment and execute the program example “MainMyBot01_HelloWorld.java“. You can now start the dialog and extend it step by step.

You will see how easy it is to extend the chatbot dialogues. In the next step you can use the sample project and import it as business logic on the Business Bot platform. After the import you only have to assign the business logic to a chatbot to test the dialogues with an instant messenger (e.g. Facebook Messenger).

Would you like to know more about this topic or use the Business Bot Platform in your company? Contact us, we are looking forward to support you around the subject chatbots in the corporate environment.

Leave a Reply

Your email address will not be published. Required fields are marked *