Intelli or Web Service?

Intelli and Web Service miniApps are quite similar. Both allow you to manipulate data. The key difference is that the Web Service miniApp can also pull the data you need from an endpoint of your choosing, whereas the Intelli only allows you to perform calculations on the data you already have.

For instance, in your Flow you might use a Web Service miniApp early on to get a JSON with particular data that you might or might not want to manipulate. But perhaps a few steps down the line you need to manipulate some data from the JSON you already have, without having to make a request to get it again. In that case, it would be appropriate to use an Intelli miniApp.

Configuring a Web Service miniApp

Wait Tab

In the Wait Prompt section, you can set up some waiting announcements,  that is things the customer will hear while the data is being pulled. In this particular example, 2.5 seconds after the query start, the customer will hear the prompt "please wait", and 5 seconds after the query start (meaning 2.5 more seconds after the original prompt), they will hear an additional prompt saying, "still trying to get some data."

In the Max Web Service Timeout section, you can set up the exact time after which the request will timeout and exit; you can also specify the prompt that will be played to the customer in that case. The customer will then be taken to the next step in the Flow you have set up, whether it means being redirected to an agent or proceeding with the next miniApp.

Keep in mind that the Max Web Service Timeout may not be less than the additional timeout (indicated above in this same tab) or the failover timeout set up in the next tab.

Web Services Tab

On the left, you can see three different tabs that can be configured: wsCall, wsCall_dev, and wsCall_uat.

They enable you to specify different API endpoints within one miniApp. For instance, you can configure the tab wsCall_dev when you are testing the application in the development phase, wsCall_uat when you are performing user acceptance testing, and wsCall when you want to use the actual production API. You can switch between them based on the envMode value you pass to your miniApp in the Flow. As such, the possible options are:

  • envMode="DEV"

  • envMode="UAT"

  • envMode="PROD"

Based on the envMode value, the application will run the correct endpoint.

You don’t have to configure all three tabs if you have no use for three different endpoints; you can just configure whichever one you are going to use.

However, keep in mind that by default your miniApp will run the wsCall tab configurations.

In the wsCall tab of your choice you have to specify the HTTP method you want to use, the HTTP endpoint, and the failover timeout. You have the ability to add as many custom HTTP headers as you want and then provide the body in the JSON format or choose the form data option and provide key-value pairs.

You can manage the Failover JSON responses by using the Download/Upload Failover JSON buttons. Failover JSON is a hard-coded JSON response, stored in a file, that the web service miniApp will use in case the actual web service times out or there is an error status code response.

Keep in mind that if you provide the correct endpoint but an incorrect HTTP method, the request will fail.

If you have miniAppsCustomerSecurityAdmin, or superuser roles you can select an encryption profile from the dropdown list for each environment. For more info read Encryption Profiles.

Outputs Tab

In this tab, you can map which data you want to get from the JSON the web service request returned.

In the Fields sub-tab, you have 20 possible outputs, and for each one, you can choose to either do nothing, use a JSON path, or use a custom function.

The JSON path approach allows you to get the value directly from the JSON and return it as a specific output. For instance, in the example below the output1 will return the name of the store, and then you can reassign this output or use it later in your logic in the Flow.

If you want to modify the data first, you need to select function as the mapping method. Then you can write a function that manipulates the JSON data in the way you want in the User Functions tab and select its name here. For instance, below we have only one defined function, getDnis, the result of which (a string) will be assigned to output6.

In the Function sub-tab, you can write a JavaScript function to get some specific values of the response and set them as the output of the miniApp. This is a useful approach because it allows you to process all the data at once and then get exactly what you need (for instance, you might sort some values, calculate time difference, and so on).

You can have access to the web service response body and code by using  params.wsResponseBody and params.wsResponseCode respectively. For this type of JavaScript code, the script must return a JS object that will contain some outputs. See the example below:

var toReturn;
if (params.wsResponseCode==200){
   toReturn = { output5:"Everything is OK, I got the response from webservice", output6:};
} else {
   toReturn = { output5:"Error",output6: ""};

If you want the output function to be empty and not to assign a JS object to the outputs, the script must return an empty JSON object such as {}.

You can assign output values directly from here but keep in mind that this function overrides the field values. So if you have output1 and output2 already set up to take values from a JSON path, then having them assigned here will override those values. However, you can use something like output8, or any other output which is unassigned, i.e. has the none option in the Fields sub-tab.

In the Decryption sub-tab you can set to get the encrypted data from your endpoint and decrypt it when, for instance, announcing it to the user. To do that you need to add a decryption path. For more information please read Encryption Profiles, Add decryption path .

User Functions Tab

In this tab, you can specify a JavaScript function for either manipulating the data from the endpoint or just executing some quick actions you want to use elsewhere in the miniApp. Unlike the function in the Outputs tab, which helps deal with bigger business logic, the purpose of the user functions here is to do small actions, such as string manipulation. For instance, you might want to get DNIS values without the +1 prefix. You can write the code here (see the screenshot below) and refer to this function in your API request by including it inside the double curly braces {{}}, like {{getDnis}}.

Please make sure that your JavaScript code (whether you have it here or in the Outputs tab, or both) is correct and does not have any syntax or logical errors. You can test it using any JavaScript engines online (for example, ) or offline (nodejs14). At the moment, we are not providing code checking functionality, so if your code is incorrect the miniApp will not work.

Manage Languages Tab

To see the details on how to configure the Manage Languages tab, check out this article.

Configuring an Intelli miniApp

As was mentioned before, Intelli is a simplified version of Web Service, so it allows you to process data without hitting an endpoint. For that reason, this type of miniApp doesn’t have Wait or Web Service tabs, but the rest of the setup is exactly the same.