Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor



A smart salesman is always who know his/her customer very well about what they want and thatswhy they make successful sales, but this smartness these sales people dont get overnight, they study about their customer and their problem and find the best solution to sell which would help. Lets look at another example of our daily activity 'Suppose you have ordered food and your food delivery agent come to your house and called but due to some reason you missed the call and you see you got a missed call from unknown number, now in this case most of the people would go to true caller to see the person behind number and  eventually find it is delivery boy and you will have context to call him and get the fact straight to get your order' but you may be wondering why i am discussing these kind of story in this blog. Well i get many question from people is Conversational AI really smart enough to handle situation smartly and that make me think that we create Conversational AI bot, we are the creator so why can't we make them Smart, it how we build the Conversational AI experience for a organization. And in today's blog you will see how we make our Enterprise Chatbot Smart to create intuititive Conversational Experience to make your Enterprise more Intelligent.

It's Information which makes everyone smarter


If you look at above two cases, you would find in both cases Information plays a big role and more than that How we fetch those Information which is really matters, isn't it. If salesman never researched about the customer problems or the person who ordered food if hever checked the number in truecaller he would have started with question who and why did he get missed call and definately waste some time. From this one thing is clear if we want to make our AI Based Enterprise chatbot similar smarter first thing our bot should know is who is communicating without even asking. In a nutshell capturing user information without asking them, thats called smart bot. Because when you have information who is communicating with you, it becomes easier about that person what he need to do, what he has done almost everything.


Business Story

Company ABC is US based company who is mainly into development and consulting services for enterprise software, and they have recently simplified and automated most of the business process using SAP Conversational AI, SAP Cloud Platform, SAP S/4HANA and SAP SuccessFactors. Sudip is newly On-Boarded Employee who is a part of the development team who doesn't know what to do after first day like what other Employee Profile Information (Declaring Emergency Contact, Bank Account Number,Passport etc) need to submit and how sudip will get the laptop to start working. Sudip was introduced in on-Boarding Training a Smart AI based Assistant 'Sarah' that orginazation recently developed for helping all the Employee  and this smart AI bot is available in Organization's MS team and Skype. So sudip open MS Team and start conversation with Sarah and ask what he has to do, without even asking the name and all Sarah fetch data from SuccessFactors and return the Incomplete information which is pending from Sudip's Side. Sudip also asked that he need laptop, sarah checked sudip's job profile and Budget and recommend the Macbook Pro as sudip would be dealing with ios App Development. In whole Conversation Sarah never asked what is Sudip's employee ID, what is name and all, because Sarah could see in MS team who is communicating, what is his email, employee id just like us. isn't it cool.


How it's Possible (Tell us the trick :P)

You mightbe asking yourself, what this guy is talking about, We also have developed lots of chatbot using SAP Conversational AI, We always had to ask the name, employee ID. You are absolutely right because you might have used standard MS team Channel or Connector which is available in SAP Conversational AI. But in this case we need to rebuild that connector or channel using SAP Conversational AI SDK to pass the user information like email, name in pre-filled bot memory from MS team and this concept called user context, which allow to create more personalized conversation and it definately make bot more smarter.

Let's Connect the Dots (Designing the whole Solution)

We will break this into smaller pieces so that it would be easier to understand. In this example user will ask for Pending Information to be updated in employee portal and Bot will fetch the details from SuccessFactors by calling SuccessFactors API and return what are important information need to be updated Immediately.

Step 1: Develop the Node.Js WebHook Application which will call Internally SFSF API and Get the Details. Below is the response look like


As you can see i need to pass the mail id as input which will be automatically passed to Pre-filled memory from Team using our Custom Connector.

Step 2: Desigining the Chatbot 

Design the Intent 


Setting the Base WebHook URL


Design the Skill and Configure the Webhook


In Above pic You can see this memory 'mail' is being passed as body payload which will be automatically passed to CAI through our custom build connector from MS Team.


Similarly memory name also will be passed from MS Team though our custom built connector


Step 3: Login to Microsoft Azure and Create Bot with Azure Bot Service Registration

Please follow this official documentation from Microsoft Azure to create Bot. Keep Messaging Endpoint Empty for now. We need to build Custom Connector and deploy to SAP Cloud Platform, Cloud Foundry then we can give the connector link.


Step 4: Design the Custom Connector for MS Team Which Automatically Pass the user email and name without asking from user.

** This connector doesnt give any kind of warranty **
const bodyParser = require('body-parser')
const builder = require ('botbuilder')
const nodefetch = require('node-fetch')
const sapcai = require ('sapcai')
var restify = require('restify');
const { URLSearchParams } = require('url');
// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3000,
function () {
console.log('%s listening to %s',, server.url);
// chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
appId: '<Your_App_ID>',
appPassword: '<Your_App_Password>'
// Listen for messages from users
var inMemoryStorage = new builder.MemoryBotStorage();
var bot = new builder.UniversalBot(connector).set('storage', inMemoryStorage);'/api/messages', connector.listen());
bot.dialog('/', async function (session) {
var build = new'<Your_CAI_Token>', 'en')
var bearerToken = await getToken();
var email = await getMemberEmail(bearerToken,

build.dialog({ type: 'text', content: session.message.text}, { conversationId: },{mail:email,})
.then(res => {



async function getMemberEmail(token,conversationId){
var host_url = ''+conversationId+'/members/'
const result = await nodefetch (host_url,{
method: 'GET',
headers: { 'Content-Type': 'application/json',
Authorization: token,
Accept : 'application/json' }

const output = await result.json();
return output[0].email;


async function getToken(){
const host_url = ''
const params = new URLSearchParams();
params.append('grant_type', 'client_credentials');
params.append('client_id', '<Your_Azure_Client_ID');
params.append('client_secret', '<Your_Azure_Client_Secret>');
params.append('scope', '');

const result = await nodefetch (host_url,{
method: 'POST',
body: params,
headers: { 'Content-Type': 'application/x-www-form-urlencoded'}

var output = await result.json();
output = output.token_type+' '+output.access_token;
return output;


If you look at the code then you would see when i am passing the user conversation text to SAP Conversational AI bot using dialog method i am also passing the name and mail in memory by fetching using bot connector API.
 build.dialog({ type: 'text', content: session.message.text}, { conversationId: },{mail:email,})

Now Deploy this Connector in SAP Cloud Platform Cloud Foundry using CF CLI.


Step 5: Configure the Custom Connector as Messaging End Point in Azure Bot


That's all, now you can test this, I have recorded the Video to give you the feeling. Have a look at the recording.


I Hope you all have enjoyed the video recording, Please let me know your thoughts, doubts, questions  in comment section and if you have enjoyed this blog please like and share. I wish great health and safety to all of you. 


Labels in this area