Server-side vs client-side integration

Exchanging data with a backend system is done through a Mix.dialog data access node. Consider these two use cases:

  • In a coffee application, after asking the user for the type and size of coffee to order, the dialog must provide the price of the order before completing the transaction. It needs to query an external system to get the price and provide it to the customer. See the example below.

  • In a banking application, after having collected all the information necessary to make a payment (that is, the user’s account, the payee, and the payment amount), the dialog is ready to complete the payment. In this use case, the dialog sends the transaction details to the client application, which will then process the payment and provide information back to the dialog, such as a return code and the new account balance.

Integration points

Data access nodes allow you to exchange information in two ways:

Example scenario

To illustrate the process of exchanging data in your Mix.dialog application, let’s consider a coffee application.

This application has the following dialog:

  • Dialog: “Welcome to the coffee example! What can I do for you today?”
  • User: “I want a medium cappuccino.”
  • Dialog: “Your order is a medium cappuccino for 2.80$.”

In this example, the following information is sent by the dialog application:

  • Coffee size
  • Coffee type

And the following information is retrieved from an external system:

  • Coffee price
  • Return code

Let’s imagine that the coffee application uses a backend web service hosted at https://coffee.app.com:443 that supports the following HTTP calls:

  • POST /coffee/price: Using as input the coffee type and coffee size, this endpoint returns the coffee price
  • POST /coffee/calories: Using as input the coffee type and coffee size, this endpoint returns the number of calories in the coffee selected

Let’s say that in your dialog application, after having collected the coffee type and size, you want to provide the price to the user for confirmation.

To implement this scenario, you configure the data access node to specify the following:

  • Web service base URL
  • Method name (for example, POST)
  • URL extension (for example, /coffee/price)
  • Body of the request, which consists of the data to send to the web server. The body values can be static (such as a hardcoded string) or dynamic (such as the entity values collected from the user); for example, this could be the values of the COFFEE_SIZE and COFFEE_TYPE entities
  • Data expected from the web service, for example, coffeePrice

At runtime, the dialog engine creates an HTTP request from the data access node configuration and then executes that request, as shown in the following interaction:

  • Step 1: The user says: “I want a medium cappuccino.” This is sent to the Mix runtime environment, which performs ASR and NLU.
  • Step 2: The dialog engine encounters the data access node, which indicates that it needs to resolve the coffee price through a server-side web service, so it builds and sends the configured HTTP request to the service.
  • Step 3: The service returns the coffee price, based on coffee type and size.
  • Step 4: The dialog engine returns the message to play: “Your order for a medium cappuccino is 2.80$.”

Data access process flow for coffee app

We’ll use this scenario in the topics that follow in Exchange data from dialog application and Exchange data with client application.

Specifying server- vs. client-side integration

Exchanging data in Mix.dialog is configured in the data access node. To specify whether data is exchanged using a server-side integration or a client-side integration, set the Enable client-side fetching integration option as follows:

Enabling client-side fetching
Value Example Description
Enabled Enable client-side fetching Client-side integration; data is exchanged between the dialog service and the client application, using the DLGaaS API.
Disabled Disable client-side fetching Server-side integration; the dialog service interacts directly with a backend system to exchange data.