How to connect Service Now in Dialogue Studio
Introduction
In this guide will show you how you connect to Service Now for your self-service bot. This can be implemented as a chat-bot, by using a chat based application. For example the WebChat for WebAgent. This can also be implemented as a voice bot by using the transcription, see: How to configure a simple Voice Bot (with Azure OpenAI) in Dialogue Studio.
Prerequisites
For this scenario the following point must be done first:
-
UCC A Unified Contact Center, or UCC, is a queue of interactions (voice, email, IM, etc.) that are handled by Agents. Each UCC has its own settings, IVR menus and Agents. Agents can belong to one or several UCCs and can have multiple skills (competencies). A UCC can be visualized as a contact center “micro service”. Customers can utilize one UCC (e.g. a global helpdesk), a few UCC’s (e.g. for each department or regional office) or hundreds of UCC’s (e.g. for each bed at a hospital). They are interconnected and can all be managed from one central location. configured with Dialogue Studio
-
Service Now user with read / write permissions
-
In this example we are going to retrieve a incident, in that case the user needs to following roles:
- itil
- rest_api_explorer
- rest_service
-
Lookup Incident
In this example we will be looking up a incident based on the incident number.
Preview
Configure
-
Login to your Dialogue Studio environment
-
Open or Create a Tab where you want to add the IVR Interactive Voice Response, or IVR, is a telephone application to take orders via telephone keypad or voice through a computer. By choosing menu options the caller receives information, without the intervention of a human operator, or will be forwarded to the appropriate Agent.
-
From the menu in the top right, select “Import” and add the following JSON.
CopyJSON[{"id":"f42b291377a10186","type":"http request","z":"eed2530b97e201aa","name":"Request to ServiceNow","method":"GET","ret":"obj","paytoqs":"ignore","url":"{{{ServiceNowUrl}}}/api/now/table/incident?sysparm_query=numberENDSWITH{{{incidentnumber}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"basic","senderr":false,"headers":[],"x":930,"y":340,"wires":[["9a8086c01d0391e3"]]},{"id":"8c5230312b7cfef0","type":"inject","z":"eed2530b97e201aa","name":"Get incident based on number","props":[{"p":"incidentnumber","v":"60","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":420,"y":340,"wires":[["c126f42690cc60b7"]]},{"id":"c126f42690cc60b7","type":"change","z":"eed2530b97e201aa","name":"Configure Service Now Url","rules":[{"t":"set","p":"ServiceNowUrl","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":340,"wires":[["f42b291377a10186"]]},{"id":"5057f194514f61f2","type":"comment","z":"eed2530b97e201aa","name":"Todo: Enter Service now URL","info":"","x":680,"y":300,"wires":[]},{"id":"5040567882e9a96d","type":"switch","z":"eed2530b97e201aa","name":"Check if results","property":"msg.payload.result[0]","propertyType":"msg","rules":[{"t":"nnull"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1360,"y":340,"wires":[["6b1a838e5f96847e"],["4c6e9f415c5a10c2"]]},{"id":"4c6e9f415c5a10c2","type":"debug","z":"eed2530b97e201aa","name":"no results","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1580,"y":360,"wires":[]},{"id":"6b1a838e5f96847e","type":"debug","z":"eed2530b97e201aa","name":"Returned incident","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.result[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1550,"y":320,"wires":[]},{"id":"9a8086c01d0391e3","type":"switch","z":"eed2530b97e201aa","name":"Check statusCode","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1150,"y":340,"wires":[["5040567882e9a96d"],["a2926369735edb4b"]]},{"id":"a2926369735edb4b","type":"debug","z":"eed2530b97e201aa","name":"Failed to retreive information","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1520,"y":400,"wires":[]}]
-
Open Change node (labeled Configure Service Now Url) and enter the url of your Service Now environment (for example: https://demo-servicenow.com/)
-
Open the HTTP request (labeled Request to Service Now) and enter the Username and Password of the Service Now user
-
Open the Inject node (labeled Get incident based on number) and enter the last digits of the incident you want to retrieve
-
To test your API, click on the blue box before Inject node
-
You can use the debug menu to see the output and which debug node it entered.
Explanation
Start the Process
Action: Click the button labeled “Get incident based on number”.
What it does: This starts the process to look up an incident by its number.
Set the ServiceNow URL
Action: Make sure the ServiceNow URL is correctly set in the system.
What it does: This tells the system where to send the request to get the incident details.
Send the Request
Action: The system automatically sends a request to ServiceNow.
What it does: It asks ServiceNow for details about the incident number you provided.
Check the Response
Action: The system checks if the request was successful.
What it does:
If successful, it moves to the next step.
If not, it shows a debug message saying it failed to retrieve information.
Verify the Results
Action: The system checks if there are any results.
What it does:
If there are results, it shows the incident details.
If there are no results, it shows a message saying no incident was found.
View the Incident Details
Action: Look at the details shown on the screen.
What it does: Displays the information about the incident you were looking for.
Example uses of the information are:
-
Tell to the customer using Say node
-
Route the customer using a Switch node
-
Followup in Service Now with a new HTTP Request node
Create Incident
In this example we will be creating incident with an description.
Preview
Configure
-
Login to your Dialogue Studio environment
-
Open or Create a Tab where you want to add the IVR
-
From the menu in the top right, select “Import” and add the following JSON.
CopyJSON[{"id":"5bf88cab54fc331c","type":"http request","z":"eed2530b97e201aa","name":"Request to ServiceNow","method":"POST","ret":"obj","paytoqs":"ignore","url":"{{{ServiceNowUrl}}}/api/now/table/incident","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"basic","senderr":false,"headers":[],"x":1310,"y":660,"wires":[["f8fd4c35e6114c82"]]},{"id":"8c802ab04463afac","type":"inject","z":"eed2530b97e201aa","name":"Create incident with short description","props":[{"p":"short_description","v":"This case was created via Dialogue Studio.","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":780,"y":660,"wires":[["bbd2e9fd10f55e6d"]]},{"id":"bbd2e9fd10f55e6d","type":"change","z":"eed2530b97e201aa","name":"Configure Service Now Url","rules":[{"t":"set","p":"ServiceNowUrl","pt":"msg","to":"","tot":"str"},{"t":"set","p":"payload.short_description","pt":"msg","to":"short_description","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":660,"wires":[["5bf88cab54fc331c"]]},{"id":"4df873ea951940c4","type":"comment","z":"eed2530b97e201aa","name":"Todo: Enter Service now URL","info":"","x":1060,"y":620,"wires":[]},{"id":"01b5cb8b81f7244c","type":"debug","z":"eed2530b97e201aa","name":"Returned incident","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.result","targetType":"msg","statusVal":"","statusType":"auto","x":1770,"y":640,"wires":[]},{"id":"f8fd4c35e6114c82","type":"switch","z":"eed2530b97e201aa","name":"Check statusCode","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"201","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1530,"y":660,"wires":[["01b5cb8b81f7244c"],["a7e399cbd3819f03"]]},{"id":"a7e399cbd3819f03","type":"debug","z":"eed2530b97e201aa","name":"Failed to create incident","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1790,"y":680,"wires":[]}]
-
Open Change node (labeled Configure Service Now Url) and enter the url of your Service Now environment (for example: https://demo-servicenow.com/)
-
Open the HTTP request (labeled Request to Service Now) and enter the Username and Password of the Service Now user
-
Open the Inject node (labeled Create incident with short description) and enter the description you want the case to have.
-
To test your API, click on the blue box before Inject node
-
You can use the debug menu to see the output and which debug node it entered.
Explanation
Trigger the Flow:
Action: Sets the short_description for the incident to “This case was created via Dialogue Studio.”
What it does: Initiates the flow.
Configure ServiceNow URL and Payload:
Action:
Sets the ServiceNowUrl (you need to enter your ServiceNow URL here).
Sets the short_description in the payload.
What it does: Sets up the ServiceNow URL and prepares the payload.
Send POST Request to ServiceNow:
Action:
Uses the configured URL and payload to make the request.
Sends the request to {{{ServiceNowUrl}}}/api/now/table/incident.
What it does: Sends a POST request to the ServiceNow API to create an incident.
Check HTTP Response Status:
Action:
If the status code is 201 (Created), it routes to a debug node that shows the created incident.
Otherwise, it routes to a debug node that shows the error.
What it does: Verifies the status code of the HTTP response.
Display Results:
Action:
One debug node displays the created incident if the request is successful.
The other debug node displays the error if the request fails.
What it does: Shows the results of the HTTP request.
Example uses of the information are:
-
Tell to the customer using Say node
Tip
Url can be generated with:
CopyUrlhttps://[tenant].service-now.com/nav_to.do?uri=incident.do?sys_id=" & payload.result.sys_id
-
Route the customer using a Switch node
-
Followup in ServiceNow with a new HTTP Request node