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.
Showing results for 
Search instead for 
Did you mean: 
Hello, we are now in February 2019, and Recast.AI has been officially rebranded as SAP Conversational AI. On our first blog about chatbots, we introduced SAP Conversational AI, and the basic elements necessary to build your first chatbot in just a few hours.

This time, you will learn about an actual use case for chatbots and how it was built. We believe that only having a standalone chatbot is not enough. In order to leverage the full potential of SAP Conversational AI a chatbot needs to “talk” with an enterprise application, either from SAP or from a third party.

In this blog post we are going to leverage the integration between SAP Conversational AI  and SAP’s cloud Human Capital Management (HCM) system SAP Successfactors.

Managers normally log into their HR system to check if they have open vacation requests from their team members, and how many available leave days they have left. Or at least it is what we want them to do, so that we can book our well-deserved vacations. And since we want to have our vacations approved as fast as possible, we reimagined this workflow using a conversational user interface : Slack.

Let’s now imagine that Mya Cooper is a manager and she needs to perform two actions:

  • Open her vacation requests;

  • Check available leaves.

Using Slack, she is able to talk to satoshi (a chatbot connected to SAP SuccessFactors), where she can get the answers she needs through a conversation, and can approve, reject or skip requests without having the need to click through multiple pages.


This process which used to take a few minutes can now be done in seconds with the conversational User interface!

As you can see on the picture below, when Mya Cooper types a message into Slack, it is automatically transferred to the SAP Conversational Bot API, then to SAP Cloud Platform and finally to SuccessFactors. Then the information is sent back to the user.


Let’s now try to understand what happens when Mya “talks” with the chatbot. For example, whare happens when she types : 
Open vacation request

Firstly, Slack will forward the message to the Bot Connector of SAP Conversational AI. By the way, is where you set up the connection from the Slack space to SAP Conversational AI, as you see on the picture below:


The whole process to get the bot connected is explained in the “Connect” tab on your SAP Conversational AI development environment (as explained on our first blog).


Secondly, once the message is received, the bot connector forwards it to the Bot API, which recognizes the intent, or in other words this is where the Natural Language Processing (NLP) capabilities come into play.


Here are some of the intents satoshi can detect. On the right side, you can see the associated entities and the number of example utterances for each intent.

If a skill is associated with the detected intent and the requirements are met, the skill gets activated. For our message “Open vacation request”, the skill check-open-request gets activated as the intent @ASK-open-leave-requests is detected.

Note that every skill of this chatbot is available in English, Spanish and Japanese. The same intent can be defined in several languages, and when it is detected in any language, it activates the corresponding skill in the same language. It is super-easy to build multilingual bots this way!


Thirdly, after detecting the intent, the bot sends a POST API request to our Bot Builder URL with /ask-open-request.The Bot Builder URL is defined in the Settings of the bot and is shared by all skills.

You can see here that API requests are sent to

That URL is where sfsfrecast, our Python application resides. It can only be accessed through the API and cannot be opened through a browser.This application’s job is to link the front-end (SAP Conversational AI) to the back-end(SAP SuccessFactors)

For example, this is what happens when the POST request /ask-open-request is sent to
@app.route('/ask-open-request', methods=['POST'])
def askOpenRequest():
# parse json
reqData = json.loads(request.get_data())
language = reqData['conversation']['language']

TOTAL_OPEN_REQUESTS_COUNT = getTotalOpenRequests()
respText = "You have {} open vacation requests. Would you like to review them?".format(
quickRepliesYesTitle = "Yes"
quickRepliesYesValue = "Yes, let\'s review it."
quickRepliesNoTitle = "No"
quickRepliesNoValue = "No, let\'s skip it for now."

if language == 'ja':
respText = "{}つの休暇申請が届いています。 レビューしますか?".format(TOTAL_OPEN_REQUESTS_COUNT)
quickRepliesYesTitle = "開く"
quickRepliesYesValue = "開く"
quickRepliesNoTitle = "キャンセル"
quickRepliesNoValue = "キャンセル"
if language == 'es':
respText = "Tienes {} solicitudes de vacaciones abiertas. ¿Le gustaría revisarlos?".format(
quickRepliesYesTitle = "Si"
quickRepliesYesValue = "Si, revisemosla!"
quickRepliesNoTitle = "No"
quickRepliesNoValue = "No gracias"

return jsonify(
'type': 'buttons',
'content': {
'title': respText,
'buttons': [
'title': quickRepliesYesTitle,
'type': 'postback',
'value': quickRepliesYesValue
}, {
'title': quickRepliesNoTitle,
'type': 'postback',
'value': quickRepliesNoValue
'memory': {
'is_authenticated': 'true',
'conversation_state': 'ask-open-leave-request'}

return noOpenRequestResponse(language)


In this example, the Python app manages authentication to SuccessFactors, and formats all requests to be sent to SuccessFactors.

The app is hosted on SAP Cloud Platform (By the way, you can learn more about hosting apps on SAP Cloud platform here) and you can manage the apps hosted through the SAP Cloud Platform Cockpit.

Try the SAP Cloud Platform for Free, and discover all the services available. Eventually, SAP Conversational AI will also become one of the services available through the SAP Cloud Platform.

Lastly, the request for TOTAL_OPEN_REQUESTS_COUNT gets interpreted by SuccessFactors, and the correct answer is sent back to the SAP Cloud Platform, then forwarded through Slack back to Mya.  She gets an answer to her query  
Open vacation request

You have 1 open vacation request. Would you like to review it?

And that’s it !
Now you understand the whole architecture that allows anyone to “talk” directly with their HR system.

This example was limited to two simple intents, for demo purposes. SAP SuccessFactors has hundreds of APIs that allow users to have many different interactions with the system through similar requests. Have a look here if you want to know more about SuccessFactors API.



Bonus ! This is Charly the Chatbot (youtube video), an example of a chatbot powered by SAP C/4HANA, which allows people to do their groceries shopping completely through Messenger.

But Charly is not just a demo video to watch on Youtube. You can actually interact with it on Messenger right now.

This is its QR code. Just scan it with the camera app on your mobile device and it will open in Messenger, and guide you through the process.

Get started in a few minutes

In order to create a bot, you just need to sign up for an account on SAP Conversational AI. Note that you can develop chatbots for free for personal and test use but if you want to have a chatbot for commercial purposes you need a subscription. With this, developers can practice while contributing with useful content to the community. All without paying a single cent!

What are your allies when you build a chatbot connected to your SAP back-end ?

First, you need to understand how chatbot APIs workThen, get familiar with SAP Help, all the information that you need about SAP products, and their APIs is there.

You’ll find the best tutorials in here. We suggest that you follow the steps provided by the different available tutorials, that differ in terms of scope and level of complexity. To get started we suggest that you try out this one first.

Finally, if you want a more advanced guide on how to use odata services to interact with SAP systems, look here.

If you have any further questions don’t hesitate to contact us!

Maxime Simon
Jorge Mendes

Special thanks to Joni Liu, who did the full implementation of the HR chatbot presented here.