Start building your own chatbot now

How do you search for information about specific SAP products? The SAP Help Portal serves as an important resource for customers because it contains a lot of information about various SAP products. Wouldn’t it be great to have your own intelligent chatbot that can help you easily access the documentation for a software product on the SAP Help Portal?

In this tutorial, you will learn how to deploy a backend service and use a preconfigured SAP Conversational AI chatbot template which allows you to do exactly that. This AI chatbot can help you search for content on the SAP Help Portal and leverage the information available in the existing product documentation.

Everything you’ll need comes for free:

Architecture

The high-level architecture of our setup looks as follows:

architecture-chatbot-help-portal

The backend service (search-conversion service) in the service runtime layer (Cloud Foundry/ Kubernetes / Serverless runtime) is called from an action in the SAP Conversational AI model.

This service proxies the request to the “real” backend and the SAP Help Portal search API and returns the request in a format which your AI chatbot understands. Finally, your bot displays the search results according to your search query.

5 easy steps to build your own AI chatbot

  1. Set up the application runtime (Cloud Foundry)
  2. Deploy the search-conversion service (Cloud Foundry)
  3. Fork the preconfigured bot model (SAP Conversational AI)
  4. Customize the bot model (SAP Conversational AI)
  5. Chat with your bot (SAP Conversational AI)

steps-how-to-build-ai-chatbot-sap-conversational-ai

Step 1 – Set Up the Application Runtime (Cloud Foundry)

1.1 Get a free trial account in the Cloud Foundry environment.

1.2 Download and install the official command line client (CLI) for Cloud Foundry.

1.3 To put the Cloud Foundry CLI configuration into the correct directory, set the CF_HOME variable.

  • Variable name: CF_HOME
  • Variable value: C:\Users\<USERNAME>environment-variables-user-cloud-foundry

1.4 Restart your computer.

1.5 Open a command line tool, for example, Windows PowerShell.

1.6 Log on to the Cloud Foundry environment: cf login

1.7 Set the target API endpoint where you want to deploy the application. For an overview of the API endpoints, see Regions and API Endpoints Available for the Cloud Foundry Environment.

windows-powershell-target-api-endpoint

1.8 Enter your email and password:

email-password-login-windows-powershell

Step 2 – Deploy the Search-Conversion Service (Cloud Foundry)

2.1 Clone the backend service for the search-conversion skills from https://github.com/afritzler/search-conversion.

2.2 Navigate to the directory of your cloned backend service for the search-conversion skills. For example, C:\Users\<User>\documents\github\search-conversion

cloned-backend-service-cloudfoundry

2.3 Push the application: cf push

push-application-cloudfoundry

2.4 Get the application URL: cf a

application-url

2.5 Note down the application URL. You will need to enter this URL in your SAP Conversational AI bot.

Step 3 – Fork the Preconfigured Bot Model (SAP Conversational AI)

3.1 Logon to SAP Conversational AI. If you do not have an account yet, create one. It’s free!

3.2 Once you’re logged in, fork the search-conversion bot.

fork-chatbot-sap-conversational-ai

Step 4 – Customize the Bot Model (SAP Conversational AI)

Once you have forked the bot model, you can customize it according to your individual product requirements.

4.1 Click the Build

4.2 Open the skill search-query. This skill calls the search-conversion service.

bot-builder-sap-conversational-ai-query

4.3 Click the Actions tab.

bot-builder-action-tab-sap-conversational-ai

4.4 Adapt the request body of the webhook as follows:

  • Replace the application URL with the one that will call your application from the cloud foundry. (See step 2)
    The URL must have the following format: https://<Application URL>/search
  • Replace the product name and version defined in your project map as metadata. By default, the bot is preconfigured to search within the product documentation for SAP Landscape Management, enterprise edition software. The body must have the following format:
{
  "response_type": "<carousel, card or buttons>",
  "products": [
    {
      "name": "",
      "version": "",
      "max_results": 
    }
  ],
  "conversation": {
    "memory": {
      "query": "{{nlp.source}}"
    }
  }
}

memory-query-sap-conversational-ai-chatbot

4.5 Open the Fallback skill and adapt the replies according to your bot identity.

Step 5 – Chat with your SAP Conversational AI chatbot

The bot now calls the search-conversion service whenever it recognizes a known search phrase as defined in the @search-query intent, for example:

  • How I can connect SAP Conversational AI to Slack?
  • How can I start a system?
  • Show me the SAP Conversational AI Help Portal page

webchat-sap-conversational-ai-chatbot

If required, add more changes to existing intents and further actions according to your individual requirements.

Congrats, your chatbot is now complete!

You should now have built a fully functional chatbot that can answer questions based on your specific product documentation.

If you have any questions about this tutorial, feel free to ask us in the comments section below or go to SAP Answers.
Ready to improve your bot building skills once again? Check out our blog! We often publish new tutorials for beginners and experts.

Happy bot building! 🤖

Want to build your own conversational bot? Get started with SAP Conversational AI !

Follow us on
  • Miguel Angel Alvarez

    Hi , I get the following error once that all configurations has been made

    ” request to https://search-conversion-exhausted-hartebeest.cfapps.eu10.hana.ondemand.com/search: Request failed with status code 500″

  • Andreas Fritzler

    Hi Miguel,
    is it possible to share the logs of your CF app?
    Regards,
    Andreas

  • Sam

    Hey,
    I get following error : Request failed with status code 500.
    What can I do?

  • Andreas

    Is there a way to share the logs of your search conversion service?

  • Andreas

    Is there a way to share the logs of the search conversion backend service?

  • Andreas

    Would be great if you could open an issue here https://github.com/afritzler/search-conversion/issues

  • Constantin

    Hi! Great tutorial.
    I still got a question. Everything works fine, but is it possible to add information to {{nlp.source}}, i.e. the user enters “sales order” and the query should search in the SAP Help Center API with “sales order + “quickguide””. Hereby, I want to achieve, that the bot responds with the sales order quick guide as first answer (could be used when another intent is triggered, configured for general question e.g. “what is a sales order in general”).
    Thank you in advance!

    Constantin

    • Andreas Fritzler

      Whatever you put in the “query” string will be passed on to the Help Portal Search API. So besides nlp.source you could concatenate other things. Not sure though if the outcome would be any good.

  • Constantin

    Further: is it possible to connect another bot to search-conversion, which is not the forked bot?
    Thank you,
    Constantin

    • Andreas Fritzler

      So currently the search-conversion bot only talks to the Help Portal API. You could change that behaviour and call a bunch of different services in parallel and then aggregate those results.

    • Claudia

      Yes, you can also connect the search-conversion service to another bot. You can for example also just fork the search-query intent and skill or adjust another existing skill within your bot to call the search-conversion service.

  • Bart van de Kamp

    Is it possible to get for example the help documentation on ABAP also working?

    • Claudia

      Hi, with the search-conversion service you can search for ABAP documentation that has been published to the SAP Help Portal. Such as the SAP NetWeaver AS ABAP documentation for example. Therefore you could adjust the body of the webhook as follows:
      {
      “response_type”: “carousel”,
      “products”: [
      {
      “name”: “SAP_NETWEAVER_AS_ABAP_752”,
      “version”: “7.52.4”,
      “max_results”: 10
      }
      ],
      “conversation”: {
      “memory”: {
      “query”: “{{nlp.source}}”
      }
      }
      }

  • Yash Joshi

    How to add welcome message for my chat bot?

  • Claudia

    You can for example create a webchat and there you have the option to define a welcome message

  • Anonymous

    Hi Claudia,

    Thank you for the great blog. I have tried this and it is working perfectly. I am wondering if it will be possible to deplot in Alexa dot device? I tried deploying it but it takes some time

    Regards,
    Florence

  • Florence Mae Guzon

    Hi Claudia,

    Thank you for this blog. I have tried it and it is working perfectly. I am wondering if it will be possible to deploy in Amazon Alexa dot?

  • Florence Mae Guzon

    Hi

    I have manage to deploy the bot to Amazon Alexa. I just added a “start conversation” intent. Everything works when tested from SAP CAI website. However, when testing from Amazon developer console, it is not giving the right answers. Any idea?

    Regards,
    FLorence

This site uses Akismet to reduce spam. Learn how your comment data is processed.