Skip to Content
Technical Articles

CAI Challenge Submission: SAP CAI Chatbot Integration with SAP-TM – Cost Simulation –

This blog is part of the SAP Conversational AI Tutorial Challenge 2021 and I would like to share our business case “TransportBot” with you. With this bot, we are able to manage transportation quotations request and Freight order status via a bot.

What is our case?

Online platforms are experiencing tremendous economic growth, the market is booming and the trend is growing year after year.

Consequently, the logistical needs, in particular transport, are becoming more and more complex. The carriers’ call centers are crumbling under the various requests for quotation and no longer able to satisfy their customers’ needs.

Digital Assistants use a conversational user interface and help customers provide quality self-service.

The main purpose of this project is to design and build a digital assistant with all the necessary “skills” to process requests for quotation and hand over to the competence center for in-depth treatment.

Use Case: Cost Simulation

  1. User must, first, provide the following information:-  Source Location- Destination location- Weight
  2. The Chatbot, already connected to the SAP Backend system, will reply the user with the calculated cost based on information received.
  3. Then, he will send an email to the competence center to request an appointment.

Technical Architecture

First of all, we have created a specific OData RESTful API service in the backend system and exposed it via SAP Cloud Connector (which serves as a link between the SAP Backend system and On-demand applications in SAP Cloud Platform).

Then, we used OData Provisioning service in order to access to backend service since no SAP Gateway was available.

Step1: Exposing OData Service using SAP Cloud Connector and OData provisioning Service:

Connect SAP Cloud Connector to SAP Backend System:

Please refer to this blog post in order to achieve this step.

As we are using Odata Provisionning Service, we have created our ODATA service directly in SAP Backend system. Beside this, we implemented CRUD operations in order to read the entitysets needed.

  • Connect ABAP Backend to SCP via OData provisioning:

    Please refer to this blog post in order to achieve this step.

In order to test the newly created connection, we need to simulate a GET operation using source city, destination city and the weight to be transported.

Step 2: Building Chatbot on SAP Conversational AI Platform:

Intent Creation:

Conversation flow Build and manage:

Requirements

Create a requirement asking the bot to save the recognized “#location” entity into a memory variables called “location” and “delivery’. “#number” entity is used to store the weight of parcel.

{{memory.location.city}}, {{memory.delivery.city}}and {{memory.weight.scalar}} will be used as filters parameters in the API Query.

https://xxxxxxxxxxxxx.hana.ondemand.com/odata/SAP/ZCHARGES_SIMULATE_SRV_01;v=1/Cost_CALCSet?$filter=Source eq ‘{{memory.location.city}}’ and Target eq ‘{{memory.delivery.city}}’ and Qty eq {{memory.weight.scalar}}&$format=json

This will be done in Action tab under the chatbot Skill.

Actions

This section details how we can consume the API service. To display the response, and we will add another message.

If the customer is satisfied with transport costs, the chatbot will send an email to sales team for an appointment in order to prepare a quotation.

In order to configure email sending from SAP CAI, we designed mail template and provides API to configure and send emails using POST requests and integrate this API as a webhook for skill fulfillment in SAP CAI.

Test the bot on SAP CAI

 

Send Email

Step3 : WhatsApp Integration:

In order to facilitate its usage, Chatbot can be integrated into many messaging apps.

We have chosen WhatsApp since it is the most used messaging application in the world right now.

Here we will be using Cloud Communication Platform Twilio, we created and deployed a Twilio function which will interact with SAP CAI using SAP CAI SDK and use function URL as Webhook.

Conclusion

Following this blog, you will be able to create an natively integrated Chatbot with your ECC/TM backend and deploy it on a communication plateform.

Please share with us your feedback and comment about this use case, and feel free to get in touch with us for further details.

Your support / like would be very helpfull.

 

 

 

 

 

 

 

 

49 Comments
You must be Logged on to comment or reply to a post.