Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member207000
Participant
For the last few years, the adoption of chatbots for the optimization of services is expanding in almost all industry verticals, one such vertical is HR (Human Resources) where Conversational AI is emerging these days. You can call them Conversational Artificial Intelligence (AI), or tech buzzwords like Chatbots, Digital Assistants.

Today companies are using technology to enhance HR services to boost productivity, and help deliver more rewarding and personalized experiences for job candidates and employees.

What you will build



  • You will build a bot so that candidates can apply for job openings of their choice in a very interactive way just by pressing buttons.

  • Your bot will call API service to get the availability of openings in candidate selected area.

  • The candidate reply by selecting an answer from a predefined list, each answer in the list carries a weightage.

  • Finally, your boat will call the API service to submit the answers, and our backend program will score the candidate profile based on the total score which will be calculated by adding up the weightage of given answers.


You can build an API service as simple as calculating the score based on the weightage of user-provided answers or any Machine Learning ( ML ) based model to score the candidate's profile.

You will learn



  • How to call an API from your chatbot

  • How to fork intents and entities

  • How to trigger skills and define required data for those skills

  • How to access/store data in the memory

  • How to access data from nlp object

  • How to use Button Control with Postback event

  • How to add a chatbot to a website


 

Prerequisites


You understand the basics of creating a chatbot with SAP Conversational AI.

 

Create SAP Conversational AI account


Go to https://cai.tools.sap/, and click Sign Up in the upper-right corner.

Follow the instructions for creating an account.



 

Create a new bot project



Fill in the following details


 

Open your project and you will see two pre-defined intents  @greetings and @goodbye , which have the basic skill to greet the candidate.


Go to the Build tab, you will see greetings skill, we'll change it based on our business needs.

Click on greetings skill to open it.

 


In the Triggers tab, you'll see the condition that the skill is triggered only when @greetings or @goodbye intent is present.

We need to go to the Actions tab as we want to make changes on how the bot will greet the candidates.

You can click on ADD NEW MESSAGE GROUP button to add a new message group or edit the existing one and then add the following details.

In the condition, we have added that the #person entity should be absent. The reason behind this is that our pre-defined intent  @greetings is associated with the #person entity and it will trigger the greetings skill.


Now when our bot finishes greetings and introduces itself, it will ask for the candidate's name.

Which then trigger greetings skills and here we added a new message group to handle that conversation.

We have added the condition that this action group will be triggered when the #person entity is detected.


We set the memory filed name to store the candidate name so that we can refer to the same during our conversation with the candidate.
{
"raw": "{{nlp.entities.person[0].raw}}",
"value": "{{nlp.entities.person[0].raw}}"
}

Here we access the candidate name from the nlp object as shown above.

Then we added Text control to greet the candidate while referring to his/her name. The following syntax shows how to access the name from memory that we stored earlier.
Welcome to SAP Careers ,  {{memory.name.raw}}

Finally, to proceed with our conversation with a candidate, we added buttons with Postback events to know the area where candidates want to apply for a job. And an interested candidate can select from the list of available job areas in your organization.

 

Now go back to the Train tab, it's time to fork the  @jobdetails intent that will handle the rest of the conversation with the candidate.

Search for @jobdetails intent and then click on Fork to add the intent to your project.


Click on the @jobdetails intent to open it. Here you see we have added expressions, in other words, the conversation which will trigger the @jobdetails intent.

Here you can add/modify more expressions based on your business needs.


 

You also see few entities are associated with our intent which are :




#GETNOTICEPERIOD







#GETREPLY







#DEVROLE







#JOBAREA







#TECHTYPE







#GETEXP







Goto Entities tab to see this list of entities. We created these entities as a restricted entity, as the candidate reply is expected from the list provided options, which we would like to process in our API service later to score the candidate profile.




Click on any entity to explore it, you will see the list of values that we would like to capture from the candidate's response.


 

Now it's time to give some skill to perform some action based on user inputs.

Go to the Build tab and you will see getjobdetails_dev skill, which we created to handle our first job area "Development and technology". And a very similar way we can create skills to handle other job areas in the list.


Click on getjobdetails_dev to explore it.

Here we specify few conditions when we want this skill to trigger. There are two conditions when either one of the conditions met this skill will trigger.


Now Click on the Actions tab, and Click ADD NEW MESSAGE GROUP button, then add the following details.

  1. First, specify the condition when this action will be taken, here we have condition #jobarea is present to trigger this action.

  2. Then we called an API Service to get details of opening in the user-selected job area. Then storing the API service response in the result field.

  3. Next, add Text control to show the result to our candidate to proceed with the conversation. We'll use the following scripting tag to access the result field.

  4. We'll add a few buttons with Postback, to get the preferred Development Role from the candidate.
    {{api_service_response.result.body.message}} 


  5. Finally, store the user-selected option of #jobarea in the memory to access it later.
    {
    "raw": "{{nlp.entities.jobarea[0].raw}}",
    "value": "{{nlp.entities.jobarea[0].value}}"
    }​



 



 

Now when the candidate selected his/her preferred development role, it's time to move ahead with our conversation. We added a new message group to get the Preferred technology choice.

And then storing the development role choice in the memory field devrole.
{
"raw": "{{nlp.entities.devrole[0].raw}}",
"value": "{{nlp.entities.devrole[0].value}}"
}


After the candidate chooses the technology choice we want to get the relevant experience in that technology, so we added the following message group and then stored the technology type selection in memory.
{
"raw": "{{nlp.entities.devrole[0].raw}}",
"value": "{{nlp.entities.devrole[0].value}}"
}


Now we want to provide some information to the user regarding the location, so we refer the candidate by his name and provide the details. And then check the candidate's consent.
{{memory.name.raw}}, one important information for you, all our positions are based out of Gurgaon and Bengaluru.  


After checking the candidate's consent on available position location, bot frame question to check the current location of the candidate.


Then bot frames the question regarding the notice period to get information about his/her notice period and store the location provided by the candidate in memory.
{
"raw": "{{nlp.entities.location[0].raw}}",
"value": "{{nlp.entities.location[0].value}}"
}


 

Now it's time to ask the candidate to upload the resume. Here we provided a button with a Link, when someone clicks on that button it will open a webpage to upload the resume.

The bot will wait for the candidate to confirm when he/she finish uploading the resume.

Also, save the notice period information in the memory field getnoticeperiod.


And finally, after greeting goodbye to the candidate, we send the candidate selection to API service for candidate profile scoring.


 

To send the response to API service, we'll use connect to external service, and set the API service configuration body as shown below.


Following JSON type data we are sending to our API for profile scoring. You can add as many parameters as you want, based on your business needs.
{
"candidate": [
{
"id": "name",
"value": "{{memory.name.raw}}"
},
{
"id": "area",
"value": "{{memory.jobarea.raw}}"
},
{
"id": "role",
"value": "{{memory.devrole.raw}}"
},
{
"id": "techtype",
"value": "{{memory.techtype.raw}}"
},
{
"id": "experience",
"value": "{{memory.getexp.raw}}"
},
{
"id": "noticeperiod",
"value": "{{memory.getnoticeperiod.raw}}"
},
{
"id": "location",
"value": "{{memory.location.raw}}"
}
]
}


Connect


Goto Connect tab--> Click on Webchat--> Enter the name --> Create.


 

Copy the Webchat script code, the javascript code for your HTML page.

 


Add the code to your website. Simply copy/paste the code on your website page where you want to make this bot live.

For testing, I created an index.html file and pasted this code inside <body></body> tag. Now open this index.html in your favorite browser.

 
<html>
<head>
<title>Developing Chatbot for HR with SAP Conversational AI to Get interested Candidates Apply Over a Bot</title>
</head>
<body>
<center>Welcome to Career Section</center>

<script
src="https://cdn.cai.tools.sap/webchat/webchat.js"
channelId="ec86ae13-6aa4-4575-a296-973429727fae"
token="042916767799a52f0534e0f51e6e46ba"
id="cai-webchat">
</script>

</body>
</html>

Congratulations !! Your news bot is now live.


 



 

After running one scenario if I show you the logs from my backend service, which is called two times by the bot in our scenario, at first the bot is calling the service to get Job details and then at the end sending the candidate data for the candidate profile scoring.


 

Like I earlier said, you can add as many parameters in the form of Questions, which are required to score a candidate profile based on your business need.

Hope you find that helpful! Let me know your thoughts on this in the comments section.

Thanks for reading!

 
7 Comments