Skip to Content
Technical Articles
Author's profile photo Cylia Oulebsir

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.

 

 

 

 

 

 

 

 

Assigned tags

      49 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Yassine Nait Ben Mous
      Yassine Nait Ben Mous

      Hi Cylia

      Thanks for sharing such valuable information in this blog.

      This is really helpful.

      Yassine

      Author's profile photo cherif abir
      cherif abir

      Hi Cylia

      Amazing blog.

      Abir.

      Author's profile photo Mor LOUM
      Mor LOUM

      Thank you Cylia for sharing with us your knowledges.

      Congratulations for your work!

       

      Author's profile photo William Verlaine
      William Verlaine

      Great initiative ! Thank you for sharing.

      Author's profile photo Bertrand Bourel
      Bertrand Bourel

      Hi Cylia,

      Thanks for your explanations. This could be great opportunities for our customers!

      Author's profile photo Krishna Kishore
      Krishna Kishore

      Amazing, I am sure it must be good learning experience!!

      Author's profile photo Jean-Michel SALLENDRE
      Jean-Michel SALLENDRE

      Merci

      Author's profile photo Steven Rider
      Steven Rider

      Outstanding, great post.

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thanks 🙂

      Author's profile photo Daouda Pouye
      Daouda Pouye

      Thank you for the Blog!!

      Great work. It's very helpful

      Author's profile photo Riadh BEN ATTRA
      Riadh BEN ATTRA

      Great blog ! It was so helpful 🙂

      Thank you for your sharing 🙂

      Author's profile photo Naoufel EL KHAYATI
      Naoufel EL KHAYATI

      thanks cylia , for this great blog 🙂

       

      Author's profile photo siham EL HAKKAOUI
      siham EL HAKKAOUI

      Thank you for sharing, it's a great job.

      Author's profile photo Benjamin Legoupil
      Benjamin Legoupil

      Very nice feature ! Many thanks for sharing Cylia. Great job!

      Author's profile photo Mark Albrecht
      Mark Albrecht

      Excellent case where the conversational AI is fully integrated into the Processes. Connecting the world and technologies! Great Job

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thank you !

      Author's profile photo Thomas Noermark
      Thomas Noermark

      Awesome use case proving the potential of innovation technologies.

      Great job!

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thanks 🙂

      Author's profile photo Mauricio Pinheiro Predolim
      Mauricio Pinheiro Predolim

      Congrats Cylia!

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Thanks Mauricio 🙂

      Author's profile photo Paul Sukanta
      Paul Sukanta

      Great Job Cylia. Bravo !!!

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      thank you !

      Author's profile photo Mohamed BOUNAB
      Mohamed BOUNAB

      Good job Cylia !

      On the road toward automation and UX enhancement

      Author's profile photo Nicolas DUMAS
      Nicolas DUMAS

      Thanks for sharing Cylia, very instructive.

      Author's profile photo Prashanthi Swarnakar
      Prashanthi Swarnakar

      This Chatbot natively integrated with ECC/TM backend with capability to deploy on a communication platform-Sounds great!!

      Author's profile photo Adnane MALKI
      Adnane MALKI

      That's Great, thanks for sharing.

      Author's profile photo Hanane BARKA
      Hanane BARKA

      Nicely written blog and Very helpful.

      Thanks for sharing.

      Author's profile photo Régis MENARD
      Régis MENARD

      Thank you for this great job, very helpful.

      Author's profile photo Arnaud PORTAL
      Arnaud PORTAL

      Thank you for this blog

      Author's profile photo ADIMAT Jean-Louis
      ADIMAT Jean-Louis

      Very innovative and helpful.
      Definitely a brillant work !

       

      Cheers Cylia

      Author's profile photo Caroline SCHEIDECKER
      Caroline SCHEIDECKER

      intéressant ! Merci pour le partage 🙂

      Author's profile photo CAMARA marie-emmanuelle
      CAMARA marie-emmanuelle

      Brilliant ! Thanks for sharing.

      Author's profile photo Lackyden Em
      Lackyden Em

      Thanks a lot Cylia, it's amazing !

      Author's profile photo Natalia BOCANEGRA GOMEZ
      Natalia BOCANEGRA GOMEZ

      Amazing! Thank you for sharing

      Author's profile photo Davy KHUU
      Davy KHUU

      Thanks a lot for sharing. This blog is well written and illustrated. It is clear and simple.

      Author's profile photo Mamadou FAYE
      Mamadou FAYE

      Thank you for this blog !

      Author's profile photo Habib NDIAYE
      Habib NDIAYE

      Great work & so helpful! Thanks for sharing

      Author's profile photo Amine ZOGHLAMI
      Amine ZOGHLAMI

      Excellent content ! Thank you for sharing !

      Author's profile photo Zohair Taheraly
      Zohair Taheraly

      Excellent post Cylia ! Thanks for sharing.

      Author's profile photo ANTOINE SHAFIK
      ANTOINE SHAFIK

      Thanks for this blog. Interesting !

      Author's profile photo Adrien MANIER
      Adrien MANIER

      Great POC with a lot of potential!

      Author's profile photo Birahime FALL
      Birahime FALL

      Thank you for this blog

      Author's profile photo Hervé CHAPON
      Hervé CHAPON

      Thanks for sharing, Cylia. Great job !

      Author's profile photo MEUNIER Hanen
      MEUNIER Hanen

      Thanks for sharing ! Great POC !!

      Author's profile photo amine benmoussa
      amine benmoussa

      Great job, thanks for sharing

       

      Amine b.

      Author's profile photo VIGNESH S V
      VIGNESH S V

      Hi Cylia,

      Could you please explain the steps of OData Provisioning rather than providing an older blog. As we all know SAP Cloud Platform has upgraded a lot.

      It would be very helpful, if you can provide with latest BTP blog or screenshots.

      Thanks,

      Vignesh.

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Hi Vignesh,

      As shown in this blog post, the cloud connector must first be configured and connected to your backend system.

      You need to make sure the /iwbep/ resource is active in the cloud connector.

      Then go to your SCP NEO environment => services => search for Odata Provisioning service

      Go to: Configure service

      Add new Destination:

      URL: according to the virtual host we have created on cloud connector

      http://virtuel_host/sap/iwbep?sap-client=120

      Save and check connection

      Once the connection is ok, go to service

      Click on Register to add an Odata Service

       

      I hope this has clarified things for you; if you have any questions, please feel free to contact me 🙂

       

      Regards,

      Cylia

      Author's profile photo VIGNESH S V
      VIGNESH S V

      Hi Cylia,

      Thank you for your brief explanation. As we all know, Neo trial is no more and in Cloud Foundry there is no option for OData Provisioning. Could you please explain how to go ahead for OData provisioning on CF trial ?

      Thanks,

      Vignesh.

      Author's profile photo Cylia Oulebsir
      Cylia Oulebsir
      Blog Post Author

      Hi Vignesh,

      We can connect directly to the backend system using Odata Provisioning instead of going through the gateway.

      Unfortunately, the Odata Provisioning service is not available in the CF, but you can use gateway system to consume OData services.

       

      Regards,

      Cylia.