dydu documentation
FrenchEnglish
  • A Single Software, various applications
  • First use guide
    • Getting started
    • Create your bot
    • Create your first knowledge
    • Create and publish your chatbot
    • Frequent use cases
    • Best practices
    • Glossary
  • Contents
    • Knowledge
      • Knowledge management
      • Tags management
      • Knowledge types
        • Answer to a question
        • Complementary answer
        • Predefined answer
        • Event-triggered knowledge
        • Slot filling
      • Answers elements
      • Accessibility for bot answers
      • Decision tree
      • Comments
      • Test the bot
      • Qualities alerts
    • Knowledge map
    • Matching groups
    • Global sentences
    • Language / Spaces
    • Context conditions
    • External Contents
    • Gallery
    • Web services
      • Web Services
      • Configuration examples (REST)
      • Configure OIDC on Keycloak for a Web Service
      • Frequently asked questions
    • Advanced
      • Server scripts
      • Predefined answer templates
      • Variables
      • Web services triggers
      • Top knowledge
    • Tools
    • Import/Export of knowledge
  • Learning
    • Dialogs
    • Suggestions
    • Misundestood sentences
  • Analytics
    • Exploitation
      • Important
      • Dialogs
      • Visitors
      • Themes
      • Knowledge
      • Qualification
      • Users feedbacks
      • Clicked links
      • Rewords
      • Performance
      • Other
    • Livechat
      • Dialogs
      • Knowledge
      • Operators
      • Satisfaction
      • Waiting queues
    • Knowledge base
      • Formulations
      • Users
      • Matches
    • Export
    • Configuration
  • Custom analytics
    • Reports
    • Alerts
    • Configuration
      • Reports
      • Exports
      • Predefined sources
      • Alerts
      • Preferences
      • Annex: List of indicators
  • Livechat
    • Enable livechat
    • Knowledge base setup
    • DYDU Livechat
      • Overview of interfaces
        • Operator Interface
        • Manager interface
      • Dydu livechat setup
        • General
        • Competencies
        • Waiting queues
          • General
            • Setting up the waiting queue
          • Competency
            • Setting up the waiting queue by competency
            • Setting up a knowledge base with the waiting queue by competency
        • Operator capactiy
        • Account parameters
    • Genesys Livechat connector
  • Integration
    • FAQ
      • Static FAQ
      • Dynamic FAQ
    • MetaBot
    • Customisation
    • Javascript actions
    • Custom event-triggered rules
    • Channels
      • Dydubox
      • Dydubox advanced
        • Css editor
          • Teaser
            • CSS Teaser Modification
          • Header
            • CSS Header Modification
          • Body
            • CSS Body Modification
        • Custom JS Editor
        • Label management
        • Possible integrations
      • Connector
        • Teams
        • META
          • Messenger
          • Instagram
          • WhatsApp
          • Compatibility of DYDU bot features with META
          • Meta application control
    • LLM - Generative AI (Artificial Intelligence)
    • Integration of a chatbox into a webview
  • Preferences
    • SAML 2
    • OpenID Connect (OIDC)
    • Users and rights
    • Bot
      • General
      • Dialogs
      • Survey
      • URLs
      • Search field
  • Other
    • How does your bot work?
    • Data protection
      • Cookie management policy
    • Console logs
    • Special keywords
    • Technical aspects
      • Hosting
      • Infrastructure
    • Security
      • General information
      • Server usage
      • Open source tools
      • User session expiration
  • Developers
    • API reference
      • Authentication
      • Dialog API
      • Dialogs Export
      • Search field
      • Import Export Bot
      • Import/Export Knowledge Base
      • Server Status API
      • Access to APIS
      • User Management in the BMS
    • Chatbox V5
      • Setup and integration
Powered by GitBook

Tous droits réservés @ 2023 dydu.

On this page
  • Example 1: Weather Web Service Configuration
  • Creating and configuring a web service
  • Creation of the associated knowledge
  • Example 2: Use the web service in a condition
  • Example 3: Web service configuration - IP address
  • Creation and configuration of the web service
  • Creation of the associated knowledge

Was this helpful?

  1. Contents
  2. Web services

Configuration examples (REST)

PreviousWeb ServicesNextConfigure OIDC on Keycloak for a Web Service

Last updated 10 months ago

Was this helpful?

Example 1: Weather Web Service Configuration

This section describes the steps to configure a REST weather web service to automatically respond to user requests. You can use the openweathermap service () for this purpose. You will need to create an account to obtain an API key.

To carry out this configuration, you must perform the following steps:

Creating and configuring a web service

1 - Go to Contents > Web Services.

2 - Click on Add and then select Rest Web Service.

3 - Fill in the following fields in "Web Service Configuration".

  • Name : "Meteo"

  • HTTP Method : GET

  • Type de réponse : JSON

4 - Fill in the following fields in "Parameters".

  • APPID: The parameter is provided by WorldWeatherOnline after creating an account.

  • lang: fr

  • q: ${capture.ville meteo}

5 - Click on "Add" in the "Result Variables" category and add the following two variables:

Attention: variable names are free to choose but must be consistent with what is indicated in the knowledge. Variable names must consist of alphanumeric characters or underscore characters and start with a letter. They are also case-sensitive.

6 - Change the JSON output format with the following values:

function dyduParseJSON(json) {
 // returns a map return {
     "name" : json.name, 
     "description" : json.weather[0].description, 
     "temperature" : parseInt(json.main.temp / 10)
      } 
      }

7 - Test the configuration of your web service.

with the test value 'Paris' in the parameters:

Creation of the associated knowledge

The objective now is to create knowledge to provide data to the web service and deliver it to users.

Configure the query:

User's phrase : The sentence should resemble a request to know the weather in a given city. The crucial point in this sentence is not to forget the variable. In our example, the variable is called "ville" and it is Alphanumeric type.

1 - Create a knowledge "What is the weather in" and then click on "T".

2 - Search for the variable "Ville"

3 - Click on the city group and name the variable "villemeteo"

4 - Click on "update"

5 - Click on "Create" to create the knowledge

Configure the response

The response given to the user will display the temperature and the city understood by the system to identify any discrepancies.

It is important to note that:

  • Variables retrieved from the web service are structured as follows: ${callapi.WebServiceName.variableName}

  • Variables retrieved from the dialogue box are structured as follows: ${capture.VariableName}

For more detail :

Example 2: Use the web service in a condition

Web services can be used in knowledge but also in conditions. Reuse the weather service to find out if it's hot or cold in a city. In our example, it is considered that it is hot at more than 20 degrees and cold in the opposite case.

1 - Create a new knowledge to answer.

2 - Then create the two possible answer with a new condition that you leave blank for now:

Once the knowledge part is prepared, you have to create a new condition that will use the web service. To do so, visit the Knowledge > Advanced > Context conditions page.

1 - Click Add a condition and create the associated condition:

Note that the operation is of Math expression type and the value must be a correct expression with x the variable returned by the expression in Condition. Here, we must check that callapi.TestWeather.Temperture > 20.

Finally, we must use this new condition in the knowledge we have created. To do so:

1 - Edit the condition, select IsTempertureGreaterThan20

2 - Click Update.

You can now test your knowledge with the bot.

Example 3: Web service configuration - IP address

Creation and configuration of the web service

1 - Create a web service in REST mode.

2 - Enter the JSON code in the Result Variables section :

function dyduParseJSON(json) {
	 return {'ip' : json.origin};
}

3 - Enter the variable "IP" by clicking on "add". You can add as many variables as you want.

4 - Then click on Save.

5 - Click the Test button to verify that the web service is operational.

If there are no errors, the IP will be returned to you; otherwise, an ERROR element may appear. It's important to note that HTTPS web services may not work. If that's the case, simply remove the "S" to use HTTP protocol only.

Creation of the associated knowledge

Next, go to the Content > Knowledge page and create a new knowledge entry like the example below:

You can then test your knowledge by asking your bot through the test dialogue box. Ask it the question "What is my IP?" and the bot will return your IP address.

URL : ""

Here we will use the httpbin web services: and specifically the IP web service that returns the IP of the requesting user.

http://api.openweathermap.org/data/2.5/weather
http://httpbin.org/
https://openweathermap.org/api