- https://people.sap.com/bharath.srinivas Manager at Capgemini America Inc
- Anusha Saxena Senior Consultant at Capgemini America Inc
Our idea is to use SAP Conversational AI platform which brings rich natural language processing capability in building Chatbot and connect to Servicenow ticketing tool.
End of this Blog you will be able to
- Create a helpdesk chatbot and train it.
- Setup developer instance in ServiceNow.
- Consume ServiceNow API to manage ticketing in SAP Conversation AI.
Platforms / Tools required:
- SAP Conversational AI
- SAP Cloud Platform
- CF CLI for Cloud foundry
Service Now Developer Instance Set up
We have used servicenow ticketing tool to demonstrate use case of SAP CAI Digital Assistant as a helpdesk where the chatbot integrates with ticketing tool to get the incident details request made by user or creates the incident for user.
We require a developer instance in Service Now to test the integration of SAP Conversational AI with ticketing tool and Incident read and create operations.
Let’s create a developer account and instance in Servicenow. Logon to https://developer.servicenow.com and create an instance.
Instance creation generates an admin account with username “Admin” and a password. We can click on the URL of instance and login with the admin credentials.
We can see default incidents provided by servicenow when we click on “Incident” on the left panel followed by click on “Open”.
Now, let’s look for “Rest” in the left panel and click on Rest API explorer. We can use Table API to test the rest APIs for read, create and update operations on Incidents. Select “tableName” parameter as “Incidents”. This information is needed when we make API call from SAP Conversational AI digital assistant.
Create a Conversational AI Helpdesk Chatbot
After we have set up the ticketing tool. Our next step is to create a Digital Assistant on SAP Conversation AI.
Let’s log in to https://cai.tools.sap/
Create an account if you don’t have one.
Click on create New Bot
SAP Conversation AI does offer few intents and skills out of the box. Select Greetings, Small Talk and Customer Satisfaction and name the bot DigitalAsst.
Click on Create Bot
The first step is to train the bot to understand the user input. The first intent is to create a ticket/incident.
We can name the intent as “ticket-create”
Let’s enter the expressions that depicts this intent.
Note: Since, we are using English (Advanced Language) the AI proposes few more expressions for this intent automatically.
To make this chat bot multilingual, we can add multiple languages to the chatbot. Let’s add Spanish language to this intent and add expressions in Spanish.
Next step is to create a skill which will recognize the intent and start a conversation with the user.
New skill called create_ticket is created in this step.
Before going further with create_ticket skill, lets create few Entities which we will use in this skill.
To create ticket, we need a short description of the ticket and its category.
To achieve this, we will create two different types of entities, a free entity for capturing Description and a restricted entity to capture Category.
Now let’s open the create_ticket skill and decide on the triggers.
Here are the triggers for the skill. We will explain the reason for choosing the trigger condition along with the further steps in the blog.
Let’s create requirements for the create_ticket skill. The first requirement is to make the user enter the short description of the issue.
Once the user enters the description the bot will prompt the user to pick the category. Therefore, we made Category absent in the Triggers which would trigger the skill to enter the category.
Now to develop actions and configure the webhook that is created in SCP, we have to follow below steps in Deploy Helpdesk service on SAP Cloud Platform.
Deploy Helpdesk service on SAP Cloud Platform
SAP Conversational AI Build tool allows calling API services directly however, it is limited when we have complex logic to add while processing a request. Hence, we can use NodeJS application and deploy them on SAP Cloud Platform. SAP Could platform acts as a middleware between SAP Conversational AI and servicenow to send process the request coming from SAP Conversational AI Chatbot, query the ticketing tool API services and prepare the response to send back to SAP Conversational AI.
The chatbot calls a NodeJS application webhook to execute create, read and update operations on service now ticketing tool.
Creation of NodeJS Application
Let’s install the latest version of NodeJS from https://nodejs.org/en/ on your system.
Also, install CF CLI from https://docs.cloudfoundry.org/cf-cli/install-go-cli.html on your system.
The structure of NodeJS project will be as following which after creating it:
We will follow the below steps to create a NodeJS project:
Create a folder “helpdesk” in command prompt on your system.
Type MKDIR helpdesk followed by CD helpdesk to create helpdesk folder.
Following are the further set of steps to create files in the project after creating folder “helpdesk”:
Type and execute the npm init command to initialize and create the package.json file:
The command inputs are highlighted in yellow.
After executing below command you will see package.json and package-lock.json created in helpdesk folder.
npm install –save express body-parser
Now, let’s create a file with name js and config.js file in the helpdesk folder.
For more detailed steps please refer to following blog.
Let’s add post method ‘’create_ticket” which will read the details from chatbot service request call and call servicenow API create service with ticket details to create a ticket. It will also prepare the response message in text format suitable for SAP Conversation AI as following:
Next let’s create a config.js file in “helpdesk’ folder and place the below code with base url of ticketing tool servicenow API, User = Basic <Base64 of user ID:password> and User ID = admin.
To upload the NodeJS application “helpdesk” on SAP Cloud foundry, we will create a file manifest.yaml.
Now the helpdesk application is ready to deploy on cloud foundry.
Deployment of application on SCP
Once the CF CLI is installed in system, the application is deployed on SAP Cloud Platform with following steps.
Once the project is ready, open the helpdesk folder on Command prompt.
Let’s type and execute command: cf login.
Once the user login credentials are authenticated, type and execute command: cf push.
We can check the application status on SAP Cloud Platform after uploading as well. Let’s logon to SAP Cloud platform and check in Space followed by dev for trial version, the helpdesk application has started, and the status is in green i.e. it is running successfully.
Configure Webhook in Chatbot and Test Chatbot
After the service is deployed on SCP, let’s update the webhook in Chatbot Bot settings.
Now in actions call the webhook method to call Service Now.
Let’s test our chat bot now. Click on the button on the right hand bottom of the page.
Voila the ticket is created.
Voila the ticket is created. We can see the ticket in Servicenow.
With this blog post we saw how a Digital Assistant can be built to interact with third party ticketing tool to provide services. We now know :
- How to create a helpdesk chatbot and train it
- Setup developer instance in ServiceNow
- Develop any business logic in nodeJS and host it on SCP for Chatbot
- Consume ServiceNow API to manage ticketing in SAP Conversation AI