Skip to Content
Technical Articles

Helpdesk Chatbot with Conversational AI integrated with Servicenow

Author

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
  • Servicenow
  • NodeJS
  • CF CLI for Cloud foundry

Pre-requisites: Knowledge of creating a simple chatbot on SAP Conversational AI. Knowledge of Javascript and NodeJS.

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.

https://blogs.sap.com/2019/03/08/the-simplest-connection-between-node.js-app-and-sap-conversational-ai/

 

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.

 

Conclusion

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
7 Comments
You must be Logged on to comment or reply to a post.
  • Hi Anusha Saxena,

    Nice Blog ! I have a question though –

    I have already created a Helpdesk Chatbot with Conversational AI integrated with ServiceNow, Instead of Node JS Application we are using REST API provided by SAP Open Connectors.

    Now my concern is, I want to Update an state of the Incident using Incident number without Sys_id provided by ServiceNow.How can i solve this problem?

    Thank you in advance

    • Hi,

      Service now does not allow us to update the ticket without sys_id. What we did in our bot was we fetched the sysid using the table incident api provided by service now ->service-now.com/api/now/v1/table/incident?number=”incidentnumber” and stored the sysid in bot memory.  Then we used it to update the ticket. Hope this answers your question.

  • It was very nice blog to learn about SAP Conversational AI. Thanks for sharing

    SAP Analytics Cloud is an analytics platform that uses AI in its predictive modelling.

  • Nice blog!

    I have a question, how you guys are handling the ticket description free text here. I believe the same free type entity would not work here. Just FYI.. we used to use memory variables around 2 year back for the same purpose. Can you please highlight if you have some better solution. Would be helpful. Thanks!

    – Partha Sarathi Goswami

  • Hi Anusha Saxena,

    Can you please share how to train the bot to accept “Description” for ticketing system.

    I mean, a description can be any set of words the user may choose to describe his issue, how do I make the chatbot capable of storing whatever is being input or how to recognize the Description entity?

    Thank you in anticipation.

    • Hi. Its not possible to train a bot to understand a description. The best way would be is use to memory like we have done. Description can be anything and it is not possible to capture the intent or entities.