It’s Friday early evening. You’re longing for a cold beer and flaming hot Tacos from this new place everybody’s talking about in awe. But you’re still sitting in the office, teaching a chatbot to react to the phrase ‘Hi!’ for the umpteenth time this month. To your misfortune, the Taco-place doesn’t deliver for eating in, and since you started meditating only two months ago, it’s still a long way to a resilient you. Let’s just say you’re slightly annoyed.

Does that sound somewhat familiar? No? How about this scenario:

You’re in charge of choosing the tech to use in an upcoming chatbot project. It’s a massive opportunity for your company, and everybody’s stoked! You will rock this! You were born for this! But you never had the chance to dive into the chatbot topic and are unsure which tools to use. Panic-mode activated! You ask your best friend Google, but instead of showing you the one jaw-dropping platform, all you get is an enormous list of possible solutions. Thanks, Google, not helpful.

I have some good news and some bad news for you: The good news is that I’m going to show you a platform which will make your work easier and less repetitive. However, the bad news is that said platform in all its shininess will probably make your finely curated list ‘Chatbot Platforms and Tools to try in 2018’ a lot shorter.

EDDI – Your Enterprise-Friendly Chatbot Platform from Vienna

EDDI (Enhanced Dialog Driven Intelligence) is an enterprise-ready platform to create, test and maintain chatbots. Its developers have been working on it for over six years and started the whole thing four times from scratch.

With 20k lines of code, EDDI comes with a lot of functionalities, which is why I’m going to focus on the most important ones (or else we’ll never get to eat those tacos).

Because everybody loves lists, I’ll introduce you to the key features and benefits of EDDI in that format:

  • Source code is free to use (ASL 2.0 Licence)
  • Based on Java
  • RESTful by design
  • Communicate with other systems and databases
  • Comes with an NLP parser
  • Create behavior rules and dictionaries
  • Context information gets stored in a conversation memory
  • Extension-oriented plugin system
  • Speed up your development by reusing components and sharing knowledge among your bots

The last bullet point is my favorite: Why shouldn’t bots be able to share their knowledge as humans do? I bother my friends with questions all the time, and it takes them more than a few milliseconds to respond, so viva la chatbot!

Need more info? You can read everything you need to know and more on EDDI’s website.

Enough theory – let’s see some code!

Building an Easy Weather Conversation

We’re going to look at a quick example on how you could configure a weather feature, using a 3rd party weather API. You won’t be able to make it work by copy-pasting following code examples. Plus I won’t show you how to set everything up and running. But you can find the whole tutorial as well as a ‘Getting Started’ guide in the docs. My goal is to make you acquainted with EDDI and wake some curiosity in you to learn even more.

Like you’ve already read, EDDI has a RESTful-architecture, so all the code snippets are showing you the Request URL, Type, and Body (which is JSON).

Imagine the following conversation:

User: What’s the weather?
Chatbot: The current weather situation in Vienna is sunny at 30°C.

… and now let’s look at the code.

Step 1: Create the regularDictionary

We receive a message from the user in which he asks about the weather. So the first thing we have to do is adding the word ‘weather’ as well as phrases like ‘What is the weather’ to the dictionary. With the dictionary, we can map the user’s messages to expressions, which we then use in behavior rules, where our application decides what to do next. You’ll learn more about behavior rules in the next step, so don’t worry if this sounds a little fuzzy to you.

Request URL
POST http://localhost:7070/regulardictionarystore/regulardictionaries

Request Body

{
  "words": [
    {
      "word": "weather",
      "exp": "trigger(current_weather)"
    }
  ],
  "phrases": [
    {
      "phrase": "what is the weather",
      "exp": "trigger(current_weather)"
    },
    {
      "phrase": "whats the weather",
      "exp": "trigger(current_weather)"
    }
  ]
}

Step 2: Create the behaviorSet

Now we’re talking about those behavior rules: Our bot may know the word weather, but it has no idea how to act on it. That’s why we have to create behavior rules. You can cluster rules in groups, and every rule has a list of conditions. If all conditions are true, the corresponding rule will trigger the defined action.

Request URL
POST http://localhost:7070/behaviorstore/behaviorsets

Request Body

{
  "behaviorGroups": [
    {
      "name": "Group name",
      "behaviorRules": [
        {
          "name": "Current Weather in Vienna",
          "actions": [
            "current_weather_in_vienna"
          ],
          "children": [
            {
              "type": "inputmatcher",
              "values": {
                "expressions": "trigger(current_weather)"
              },
              "children": []
            }
          ]
        }
      ]
    }
  ]
}

 

At the top of the object you see the behavior group, and in that group, we can define rules – here we only have one. Every rule has a name, action, and children, where you specify the conditions.

Our rule’s condition is simple: The expressions from our dictionary and our condition must match – in this case the expression is trigger(current_weather). If you take a look back at the previous step, you’ll see that all words and phrases we’ve defined have a key ‘exp’ which’s value is also trigger(current_weather).
Simply put, the condition is true if the user asks about the weather and the corresponding action current_weather_in_vienna gets triggered.

Step 3: Create the HTTPCall

Our bot doesn’t know anything about the weather. That’s why he has to call his meteorological-savvy friend. We call this friend via HTTP:

Request URL
POST http://localhost:7070/httpcallsstore/httpcalls

Request Body

{
  "targetServer" : "https://api.openweathermap.org/data/2.5/weather",
  "httpCalls" : [ {
    "name" : "currentWeather",
    "saveResponse" : true,
    "responseObjectName" : "currentWeather",
    "actions" : [ "current_weather_in_vienna" ],
    "request" : {
      "path" : "",
      "headers" : { },
      "queryParams" : {
        "APPID" : "c3366d78c7c0f76d63eb4cdf1384ddbf",
        "units" : "metric",
        "q" : "Vienna"
      },
      "method" : "get",
      "contentType" : "",
      "body" : ""
    }
  } ]
}

I think the fields in our Request Body are self-explanatory. We have the target server’s URL, some query parameters and we can name the response object from which we are going to read the necessary weather data.

Step 4: Create the outputSet

The last step of our code example! The outputSet contains sentences the Chatbot sends to the user.

Request URL
POST http://localhost:7070/outputstore/outputsets

Request Body

{
  "outputSet": [
    {
      "action": "current_weather_in_vienna",
      "outputs": [
        {
          "type": "text",
          "valueAlternatives": [
            "The current weather situation in Vienna is [[${memory.current.httpCalls.currentWeather.weather[0].description}]] at [[${memory.current.httpCalls.currentWeather.main.temp}]] °C"
          ]
        }
      ],
    }
  ]
}

I’m sure you noticed the ‘action’ key again: It has the same value as the action in the behavior rule, namely current_weather_in_vienna. Because those two values match, the text in this outputSet will be sent to the user.
You may wonder what this is: [[${memory.current.httpCalls.currentWeather.weather[0].description}]]

EDDI uses the templating engine Thymeleaf which will replace this expression with the data we get from the weather API. In the previous step, we named our response object ‘currentWeather’ which you can also find in this expression.

I believe you have now a basic understanding on how EDDI works. All we did was configuring a chatbot, and the best part is, that you can use all these configurations for all your chatbots – so bye-bye repetitive work!

The big question which now evolves: What should you do from here on out?

Join the EDDI Chatbot Hackathon

What I’ve shown you is merely the tip of the iceberg of what you can do with EDDI. That’s why I am especially glad to tell you and your team about the opportunity to learn more at the full day EDDI Chatbot Hackathon in Vienna!

Not only will you be able to learn, code and connect to other chatbot enthusiasts – there are also prices waiting for the best chatbots developed during the event.
We also threw two tickets to next year’s WeAreDevelopers World Congress into the winning-pot. There you’ll undoubtedly hear some more about chatbots and other relevant topics from your field.

What you’ll need to join the EDDI Chatbot Hackathon on June 29th : Register (only 50 places are available), bring your Laptop and an idea for a chatbot, as well as some hands-on mentality.

Supply yourself with more information on the event’s website. And don’t forget to reward yourself with some flaming hot tacos!

Share this article

Share on Facebook