If you want your chatbot to be able to know the answer to more than just the things you teach it about your business you can integrate to other services. Why invent the wheel twice? With integrations, you can have loads of information that might change from day to day without having to constantly update your solution manually.

Let’s look into how you add an integration in Teneo Studio.

To correctly handle an input of a user, a bot may need to connect to external services. For example, you may want to provide weather information or your bot may need to initiate a reset password process. In Teneo these calls to external services and the handling of their responses are carried out by Integrations. You add an integration to your solution once, after that it’s available for any flow in that solution.

In this example, we will create a flow that uses an integration that provides the number of calories in a coffee, like this:

User: How many calories in a flat white?

Bot: One flat white contains about 223 calories, a walk of about 56 minutes should be enough to burn them.

To make this possible, we are first going to set up an integration and then create a flow that makes use of the integration. The final result will look like this:

Set up the Nutrition Integration

First, we’re going to set up the integration. These are the steps to add an integration in Teneo:

  1. Open the ‘Solution’ tab in the solution’s main window and select ‘Resources’ in the purple bar on the left hand side
  2. Select ‘Integration’ at the top
  3. Click the ‘Add’ button to create an integration
  4. Name the integration Nutrition
  5. Click the ‘back button’ in the top left to leave the integration’s backstage view so that you enter the main integration view

Set up a Method

An integration can contain multiple methods. A method is a block of code which only runs when it is called. You can pass data into the method and after executing the code, the method return the results. Here we want to create a method that returns the calories and walking duration to burn these calories for the coffee drink that was passed into the method.

When you created the integration, a ‘Default Method’ was automatically created. Let’s give it a proper name and add an input parameter we will use to pass data into the method and add two output parameters that we will use to return the results:

  1. Re-name the method by replacing ‘Default Method’ in the ‘Name’ field with Get calories and add the description Returns calories for a given drink and the walking duration required 
  2. to burn the calories.
  3. On the right, click on the ‘Inputs’ and the ’Outputs’ tab to see the input and output parameters (if not yet visible already).
  4. Click ‘Add’ in the input parameters panel to add a new input parameter (for the coffee to find the calories for) and give it a name and a description:
  • Name the input parameter query.
  • Add the description: The coffee drink to find the calories for. For example: 'cappuccino' 
  • or 'espresso'.
  1. Now let’s add an output parameter for the calories found. Click ‘Add’ in the output parameters panel and name it as follows:
  • Name: calories.
  • Description: The calories found.
  1. Finally, add the last output parameter for the walking duration:
  • Name: walkingDuration.
  • Description Walk duration in minutes to burn the calories.

Add the Script to the Method

To complete the method, let’s add the script which will be executed when the integration is called by the flow and save the method:

#integration #machine learning #chatbot #rpa #chatbot development #conversational ai #ai artificial intelligence #ai chatbots #cpaas

Chatbot Integrations – Adding an Integration in Teneo - DZone AI
1.45 GEEK