SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams – Part 4
Hope all is going well!
Myself & Kunj Bihari Shukla has been working on SAP Conversational AI Chatbots for a while and want to share one of the interesting use case in which, we will do an end to end integration from the S/4 Hana system to SAP Conversational AI Chatbot and then access the chatbot from the MS Teams.
This blog post is the 4th part of the blog series SAP SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams.
- SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams – Part 1 ,
- SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams – Part 2 ,
- SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams – Part 3 and
- SAP S/4HANA integration with SAP Conversational AI Chatbot using MS Teams – Part 4
Let’s have a quick recap of what we have already achieved in this blog series:
- OData service has been activated / created in the S/4 Hana onPrem system
- OData service has been exposed to the SAP BTP trial account via the SAP Cloud connector.
- Successfully created Destinations
- Successfully created Connectivity & Destination instance.
- NodeJS application has been created and deployed to the SAP BTP using CLI.
- We have a working public service API.
By the end of the last blog post we had a working API using which the purchase order, purchase requisition and sales order data can be easily accessed from the backend system.
In this blog post we will create a SAP CAI chatbot (by forking a chatbot) and integrate it to the service API created in the last blog post. Once done, integrate the CAI chatbot with MS Teams so that users can easily access the chatbot.
- Create SAP CAI Chatbot — In order to limit the scope of the blog we will create a SAP CAI chatbot by forking an existing bot).
- Integrate Chatbot to the Service API — to access OData services in the CAI Chatbot, integrate the chatbot created with the service API.
- Integrate the chatbot with the MS Teams — to consume the chatbot over teams, so user can access the chatbot during their day to day work
- Final Testing — of the bot
- Access to SAP CAI community edition account.
- Basic Understanding of how to create a chatbot. For the same please go through the below tutorials:
- Access to Developer portal or App Studio app in MS Teams.
Create SAP CAI Chatbot
- Lets create a chatbot. To create a chatbot we will fork the chatbot.
- To fork the chatbot open the link https://cai.tools.sap/kunju1991/automation-bot/train/intents and click the fork button
- Once the chatbot is successfully created, click on the bot to edit the details.
- Since its a new bot we need to train the bot by clicking the train button. Once done you will see the green light next to the Train button.
Integrate Chatbot to the Service API
Lets now Integrate the CAI Chatbot to the service API we generated in the last blog. For the same do follow the below steps:
- Click the Settings button
- On the left side menu, click on the environments tab and paste the URL as obtained earlier (in the last blog post) and click on the save button.
- Once done we have a working chatbot.
Chatbot integration with MS Teams
Now the chatbot has been tested, lets integrate the chatbot with the MS Teams, so user can access the chatbot with much more ease. Lets get started.
- Go to MS Teams search for the Developer Portal app in the search box, once found open it and navigate to the App studio tab.
- In the app studio tab click on the button Create a new app
- Enter all the necessary details for the app as in the below image
- So now for the MS Teams app we need to create an azure hosted bot. This bot will be linked to the SAP CAI Chatbot. Do follow images to setup the bot.
- During this next few steps, we can see the App ID, for password do click the Generate password button. We will also get the messaging endpoint URL which needs to be maintained in the Azure bot as bot endpoint address. These three details are important for integration of the CAI chatbot with the Azure bot.
- Open the SAP CAI chatbot in the SAP conversation AI portal and click on the connect tab
- Select the third party channel to be added for us we will go with Teams via Azure
- Enter the App ID and password and click on the connect button
- Once done a Messaging endpoint URL will be generated, copy it and maintain at step 5.
- In the MS Teams azure bot, download the package
- In order to test the bot in MS Teams, create a Teams Team for the same we have created Innovative Tech Lab Team. In the team go to Apps tab and click on Upload a custom app link to upload the package downloaded in step 10.
- Once done a popup with add button will be diplayed, click the Add button.
Test The chatbot
We are done with the High level Architecture overview in this blog post, It’s time to get into action. We will come up with follow-up blog posts very soon.
Thanks for taking your time to go through this article, we hope you liked the content. We would appreciate if you can spare few minutes to leave us feedback on your experience.