Skip to content

Commit e21505a

Browse files
Create README.md
This readme file contain info about how to integrate ServiceNow with AI
1 parent 380ea6d commit e21505a

File tree

1 file changed

+92
-0
lines changed
  • Server-Side Components/Business Rules/openAI

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# ServiceNow ↔ OpenAI ChatGPT Integration
2+
**Connect ServiceNow with ChatGPT using REST Message and Business Rule**
3+
4+
---
5+
6+
## Overview
7+
This project demonstrates how to integrate **ServiceNow** directly with **OpenAI’s ChatGPT** platform using only native features -
8+
no Scripted REST APIs, no IntegrationHub, and no plugins required.
9+
10+
The integration leverages:
11+
- A **REST Message** (calling OpenAI’s API endpoint)
12+
- A **Business Rule** (triggering automatically on record updates)
13+
14+
Once configured, ServiceNow can send ticket details (like short descriptions or work notes) to ChatGPT
15+
and store AI-generated responses back in the record — such as incident summaries, resolution hints, or category suggestions.
16+
17+
---
18+
19+
## Key Highlights
20+
21+
100% Native - Uses **RESTMessageV2** and **Business Rule** only
22+
Generates AI-based summaries, causes, or recommendations
23+
Works with **GPT-3.5-Turbo**, **GPT-4-Turbo**, or **GPT-4o-Mini** models
24+
Real-time execution after record creation or update
25+
No external plugin dependencies
26+
27+
---
28+
29+
## Use Case Example
30+
Whenever a new **Incident** is created or updated, ServiceNow automatically:
31+
1. Sends the incident’s short description and work notes to **ChatGPT**.
32+
2. Receives an AI-generated summary or root cause statement.
33+
3. Saves the response in a custom field (`u_ai_summary`).
34+
35+
This automation reduces manual summarization and speeds up triage.
36+
37+
---
38+
39+
## Prerequisites
40+
41+
| Requirement | Description |
42+
|--------------|-------------|
43+
| **OpenAI API Key** | Obtain from [https://platform.openai.com](https://platform.openai.com) |
44+
| **Model** | Any `gpt-4o-mini`, `gpt-4-turbo`, or `gpt-3.5-turbo` |
45+
| **ServiceNow Role** | admin / developer |
46+
| **Custom Field** | Add a field `u_ai_summary` (String or HTML) on `incident` table |
47+
48+
---
49+
50+
## Step 1 — Create REST Message
51+
52+
**Name:** `OpenAI ChatGPT`
53+
**Endpoint:** `https://api.openai.com/v1/chat/completions`
54+
**HTTP Method:** `POST`
55+
56+
### Headers
57+
| Name | Value |
58+
|------|--------|
59+
| Content-Type | application/json |
60+
| Authorization | Bearer `YOUR_OPENAI_API_KEY` |
61+
62+
### Request Body
63+
```json
64+
{
65+
"model": "gpt-4o-mini",
66+
"messages": [
67+
{ "role": "system", "content": "You are a helpful ITSM assistant." },
68+
{ "role": "user", "content": "${prompt}" }
69+
]
70+
}
71+
## — Create Business Rule
72+
73+
Table: incident
74+
When: after insert or after update
75+
Condition: short_description changes OR work_notes changes
76+
77+
Example Input (Incident Data)
78+
| Field | Value |
79+
| ----------------- | ------------------------------------------------------ |
80+
| Short Description | VPN not connecting for remote users |
81+
| Work Notes | User reports frequent disconnections during peak hours |
82+
83+
Example Response (from ChatGPT)
84+
{
85+
"choices": [
86+
{
87+
"message": {
88+
"content": "Remote employees are unable to connect to the VPN consistently, possibly due to gateway timeout or bandwidth issues."
89+
}
90+
}
91+
]
92+
}

0 commit comments

Comments
 (0)