ServiceNow
Connect Clearly AI to ServiceNow.
Overview
Clearly AI connects to ServiceNow using the OAuth 2.0 client credentials grant. In Clearly AI, the ServiceNow credentials are stored as a workspace-level secret and used for integrations across that entire Clearly AI workspace. For this reason, the OAuth client in ServiceNow should be configured on behalf of a dedicated ServiceNow system account (service principal) rather than an individual employee account. The access token issued by ServiceNow represents the OAuth application user you configure, and ServiceNow enforces table/field ACLs for that user on every REST API request.
See the Appendix for guidance on permissions, least-privilege principle, and supported modules.
Instructions
Prerequisites
You will need to be an administrator of your ServiceNow instance to complete all steps.
The OAuth plugin is typically active by default on new and upgraded ServiceNow instances, but it can be inactive in some environments.
- Activate the OAuth 2.0 plugin. Instructions: https://www.servicenow.com/docs/bundle/zurich-platform-security/page/administer/security/task/t_ActivateOAuth.html
- Set the OAuth property (
com.snc.platform.security.oauth.is.active) to true. Instructions: https://www.servicenow.com/docs/bundle/zurich-platform-security/page/administer/security/task/t_SetTheOAuthProperty.html
Create a Service Account for Clearly AI
Create or designate a dedicated ServiceNow service account that will represent Clearly AI (for example, clearly_ai_integration), and assign only the roles and permissions required for the data you intend Clearly AI to access. All API access in the client-credentials flow is evaluated as this user.
Enable Client Credentials
To use the client credentials grant type, you must perform the following steps:
- Create the
glide.oauth.inbound.client.credential.grant_type.enabledsystem property and set it totrue: https://www.servicenow.com/docs/bundle/zurich-platform-security/page/integrate/authentication/concept/client-credentials.html - Add the OAuth Application User field to the OAuth Entity form if it is not already visible: https://www.servicenow.com/docs/bundle/zurich-platform-security/page/integrate/authentication/task/add-oauth-application-user.html
Create an OAuth API Endpoint for External Clients
Create an OAuth API Endpoint configured for Client Credentials in the Application Registry. Instructions: https://www.servicenow.com/docs/bundle/zurich-platform-security/page/administer/security/task/t_CreateEndpointforExternalClients.html
- Navigate to All → System OAuth → Application Registry
- Click New and select Create an OAuth API endpoint for external clients.
- Complete the form and save. ServiceNow will generate a Client ID and Client Secret for this client.
- In the OAuth client record you created, set the default grant type to Client Credentials and set OAuth Application User to the service principal from step 1. This ensures tokens are issued with that user's permissions.
Enter credentials in Clearly AI
- In Clearly AI, open the Integrations page and select ServiceNow. Provide:
- Your ServiceNow instance URL (for example,
https://yourinstance.service-now.com) - Client ID
- Client Secret
- Your ServiceNow instance URL (for example,
- Click "Test connection" to confirm token issuance and basic API access.
- Click "Save". The credential is stored securely and is not retrievable after saving. You may delete the credential at any time.
Configure ServiceNow webhooks for Workflows
Configure a webhook when a ServiceNow record create or update should start a Clearly AI workflow in real time. Keep the OAuth connection above if Clearly AI also needs to read the record after the webhook arrives.
Generate the Clearly AI webhook secret
- In Clearly AI, open Integrations and select ServiceNow.
- Expand Webhooks, generate a secret, and enter the ServiceNow instance name (for example
dev123456). - Click Apply & Test, then save.
- Copy the webhook URL shown after save. The path is
/api/webhook/servicenowon your Clearly AI instance.
Create a Clearly AI workflow
- Go to Workflows → Create Workflow → Create from scratch.
- Add a ServiceNow Record Created or Updated trigger and choose the tables to listen on (for example
incident,change_request,sc_task). - Add a Create Project node. In Title, type
@to insert fields from the ServiceNow record. Set a submitter. - Save and enable the workflow.
Create a ServiceNow Business Rule
You need ServiceNow admin access to create Business Rules.
- In ServiceNow, go to All → System Definition → Business Rules → New.
- Name it (for example
ClearlyAI Webhook), pick the table, and enable Advanced. - Under When to run, use async on insert and/or update as needed.
- In Advanced, paste this script and replace the placeholders:
(function executeRule(current, previous /* null when async */) {
try {
var r = new sn_ws.RESTMessageV2();
r.setEndpoint('<CLEARLY_INSTANCE_URL>/api/webhook/servicenow');
r.setHttpMethod('post');
r.setRequestHeader('Content-Type', 'application/json');
r.setRequestHeader('X-Clearly-Webhook-Secret', '<WEBHOOK_SECRET>');
r.setRequestBody(JSON.stringify({
sys_id: current.getUniqueValue(),
number: current.getValue('number'),
short_description: current.getValue('short_description'),
table: current.getValue('sys_class_name'),
requested_for: current.getValue('requested_for'),
requested_by: current.getValue('requested_by'),
instance: '<SERVICENOW_INSTANCE_NAME>'
}));
var response = r.execute();
gs.info('Clearly AI webhook sent. Status: ' + response.getStatusCode());
} catch (ex) {
gs.error('Clearly AI webhook failed: ' + ex.message);
}
})(current, previous);| Placeholder | Value |
|---|---|
<CLEARLY_INSTANCE_URL> | Your Clearly AI host, for example https://your-org.clearly-app.com |
<WEBHOOK_SECRET> | The secret generated in Clearly AI |
<SERVICENOW_INSTANCE_NAME> | The instance name saved in Clearly AI webhook settings |
- Save and activate the Business Rule.
Payload fields
| Field | Required | Description |
|---|---|---|
sys_id or number | Yes (one of them) | Record identity |
table | Yes | Table name, usually sys_class_name |
instance | Yes unless set in Clearly AI webhook config | ServiceNow instance name |
short_description | No | Used as the event name |
requested_for, requested_by | No | Passed through to the workflow event |
FAQs
Appendix
Token endpoint used by Clearly AI
Clearly AI requests tokens from the standard ServiceNow token endpoint:
https://<your-instance>.service-now.com/oauth_token.do
Permissions guidance
If you see successful authentication but no records returned for tables you expect to be readable, validate the service principal’s roles and ACL access for those tables and fields, and confirm that the records you are searching for are visible to that account (for example, in environments with domain separation or restrictive table ACLs). The simplest way to confirm whether this is a permissions issue is to temporarily grant read access in a controlled way and re-test, then roll back to least privilege once the required access pattern is understood.
Least-privilege guidance
Because the integration uses a workspace-level secret and operates under a single service principal, it is important to scope permissions deliberately. Customers typically start by confirming read access to the specific tables they care about (for example, incident, change_request, problem, sc_req_item, and kb_knowledge), then tighten roles and ACL rules until the service account has only the minimum access needed for the intended Clearly AI workflows.
Supported modules
Please keep in mind that availability depends on the modules installed and licensed in your ServiceNow instance and the access controls you set on the OAuth application user’s roles and ACLs. It is normal for some tables to return zero results if the account is not permitted to read them.
The Clearly AI ServiceNow connector supports the following ServiceNow modules out of the box.
- IT Service Management records, including incidents, problems, and change requests, as well as general task records (via the Task table).
- Service Catalog request records, including requests, requested items, and catalog tasks; the connector can also read requested-item option values where present.
- Knowledge Management articles, including knowledge search and article retrieval (knowledge availability depends on the relevant API/plugin being enabled in the instance).
- CMDB configuration items.
- Users for identity resolution of reference fields.
- Attachments, including listing attachments for a record and downloading attachment content through the attachment file endpoint.
| ServiceNow area | What Clearly AI accesses | Primary tables/endpoints involved |
|---|---|---|
| IT Service Management (ITSM) | Incidents, Problems, Change Requests, and general task records | incident, problem, change_request, task |
| Service Catalog | Requests, Requested Items, and Catalog Tasks; reads item option values for requested items | sc_request, sc_req_item, sc_task, sc_item_option_mtom, sc_item_option |
| Knowledge Management | Knowledge articles and knowledge search; may use the specialized KM API when needed | kb_knowledge, /api/sn_km_api/knowledge/articles |
| CMDB | Configuration items | cmdb_ci |
| Users | Resolves user fields and looks up users by sys_id or username | sys_user |
| Attachments | Lists and downloads attachments associated with records | sys_attachment, /api/now/attachment/{sys_id}/file |
| Additional modules when present | Some record-number patterns map to additional tables if they exist and are permitted | rm_task, rm_story, sn_compliance_policy, engagement |
The connector can identify record-number prefixes that map to optional tables.
Clearly AI's connection to ServiceNow is built around ServiceNow’s REST APIs: Table API for record retrieval, Attachment API for attachment metadata and file downloads, and Knowledge API for searching and retrieving knowledge articles. These operations enforce that the calling user has sufficient roles to access the requested table data.
Contact us if you need additional modules, tables, prefixes, or permission models.