Thursday, 04 November 2021 10:53

Call SAP Search APIs in SAP Conversational AI to Enrich your Fallbacks

Written by Mohammadhadi Shadmehr
Rate this item
(0 votes)
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”

In my previous blog postI wrote about some tips around SAP Conversational AIFAQ bot configuration. Here I want to describe one of those tips in detail and show step by step how we can use a search API like SAP Search API to enrich our fallback.

The following guidelines are based on FAQ bot. However, a similar approach can be used in Action bots.


There are some points in the chat flow that your bot cannot provide the desired answer like when the confidence score is lower than 5%, when the user has been clicked on “None of the above” option, or when the user had a negative feedback caught in customer-satisfaction-reply skill.

In this situation, one of the possible additional services could be providing a search result based on the user initial query. We can do this in SAP Conversational AI by calling APIs and formatting the responses. Here I will show how to use SAP Search API to provide search result from SAP open access information when the confidence score is lower than 5%.


Figure 11 Providing search result when confidence score is low, showing in the SAP Conversational AI chat preview.

As SAP Search API requires a JWTtoken for search query, we first need to consume an API to get the token and save it in the memory and then call another API to post our query and get the search result. At the end we just need to format the response body and show the user few search results (e.g., the first five titles and links).

How to?

Step 1: Call the API

1. Go to the Build tab

2. Click on faq skill

3. Add a new Action Group

4. Add an API service to get JWT token

a) Click on Connect External Service

b) Select Consume API Service

c) Configure it as shown below


Figure 12 Using API service to get the JWT token

d) Go to the Response tab and check the Include headers check box

5. Add a memory to save the token

a) Click on Update Conversation

b) Select Edit Memory

c) Configure it as shown below:


Figure 13 By clicking on

Continue reading here
Read 148 times

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.