Skip to Content
Technical Articles

CAI Challenge Submission: Creating HR Leave Requests with a Mobile App using SAP CAI

This blog post is part of the SAP Conversational AI Tutorial Challenge 2021 and I would like to share my use case …”Day off bot” can connect to the company’s fiori system with our NodeJS server hosted in SCP and get permission from the system instead of the user, with the information entered by the user, after making the conversations about the flutter mobile application.

 

What is The Use Case

Our aim is to help employees in the company to take day off.. In order to get day off the under normal conditions, the user could first open the fiori system and fill in the relevant fields and then complete the day off the process.By using Sap Cai we developed of our chatbot and by using flutter we developed of our mobile application.We eliminate much effort for the user.Another issue we want to touch on here is that we can create our bot in Turkish as well as the languages in the advance status.

Technical Architecture

 

 

 

What’s happening in Sap Cai

 

Our bot consists of a flow like this:

When the user says hi, our bot first asks how it can help by introducing itself and contacting us. When the request for day off is received from the user, our bot informs the user by showing the day off types. Day off  types defined in our bot are divided into two structures in the fiori system. Annual, administrative leave type and annual, non-administrative leave types. When the user wants to get administrative permission, we ask the necessary questions in order to get the information to be used in the fiori system in a flow in the system where we created the user. After learning the day off type from the user, we ask whether the day off structure will be daily or hourly. If the response from the user is hourly, this time we learn whether the user wants to get her/his day off before or after noon. 

When the user specifies the day off structure on an hourly basis, we ask the user on what date she/he will receive day off.

(Even though the process of getting dates from the user varies in the daily or hourly leave structure, the steps after the leave date proceed in a general structure.)

If the response from the user is daily, we ask the user for date information in order to learn the starting date of the leave. In the Fiori system, we need to learn the address of the user as well as the information we have received above. For this reason, after the date questions, we ask the user at which address the user will be located during the day off. After this step, we redirect all the information entered by the user to the for information purposes. If the user wants to make any changes to the information he / she has entered, we direct the information we have created in the system to our correction and show the user a notification message again after the relevant changes are made. If the user is sure about the information he / she has entered, we want the user to trigger the approval mechanism and confirm the information he / she has entered. From this point on, we request information from our mobile application to the fiori system. Then, we show the user the answer from the fiori system. After these operations are completed, we ask the user whether the user wants to perform another action. We re-activate our system or end the conversation according to the negative or positive speech that the user has entered.

Let’s see the flow we have mentioned on Sap Cai

Take Day Off Request Skill

 

Approval Skill

 

 

After we realize our design in Flutter, we can communicate with sap cai with this piece of code.

Future < http.Response > postRequest() async {
        var url = 'https://api.cai.tools.sap/build/v1/dialog';
        var body = jsonEncode({
            "message": {
                "type": "text",
                "content": "\"" + getText.text + "\""
            },
            "conversation_id": "CONVERSATION NAME" + "-" + "CONVERSATION ID"
        });
        http
            .post(
                url,
                headers: {
                    'Authorization': 'Token ##############################',
                    'Accept': 'application/json',
                    'Content-Type': 'application/json',
                },
                body: body,
            )
            .then((http.Response response) {
                    var parsedResponse = utf8.decode(response.bodyBytes);
                }

 

We manage all the messages that we direct to and from the sap cai.

 

Conclusion:

Thanks to this blog post , We have learned the structure of “HR Leave Requests” bot and made its entegration with the “Flutter Mobile Application” possible.

Thank you for reading. Please share with us your views and comments on this use case.

 

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