v2026.1 Open Portal ↗
On this page

ServiceNow Integration

Prerequisites

RequirementDetails
ServiceNow instanceAdmin access to create integration users and OAuth providers
ServiceNow versionMadrid (2019) or later
StackFlow rolesuper_admin
NetworkHTTPS access from StackFlow Lambda VPC to ServiceNow instance URL

Step 1: Create ServiceNow Integration User

  1. In ServiceNow, navigate to User Administration → Users → New
  2. Create user stackflow-integration with role itil and rest_api_explorer
  3. Set a strong password and note the username/password for Basic Auth, OR proceed to Step 2 for OAuth
  4. Grant the user read/write access to: incident, problem, change_request, cmdb_ci, sc_request tables
Least Privilege: Only grant table-level ACLs required for the sync. Do not grant the admin role to the integration user. Use a dedicated integration user, not a named user account.

Step 2: Configure OAuth in ServiceNow

  1. In ServiceNow, go to System OAuth → Application Registry → New
  2. Select Create an OAuth API endpoint for external clients
  3. Set the name to StackFlow OAuth
  4. Generate a Client ID and Client Secret
  5. Set the redirect URL to: https://your-instance.stackflow-tech.com/auth/servicenow/callback
  6. Set Token Lifetime to 1800 (30 minutes) and Refresh Token Lifetime to 8640000 (100 days)
# Test OAuth token request
curl -X POST   https://your-snow-instance.service-now.com/oauth_token.do   -d "grant_type=password&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&username=stackflow-integration&password=PASSWORD"

Step 3: Table API Mapping

StackFlow uses the ServiceNow Table API to read and write records. Configure which tables map to which StackFlow modules:

ServiceNow TableStackFlow ModuleSync Direction
incidentIncidentsBidirectional
problemProblemsBidirectional
change_requestChangesBidirectional
sc_requestService RequestsServiceNow → StackFlow
cmdb_ciCMDB CIsServiceNow → StackFlow (read-only)
cmdb_rel_ciCMDB RelationshipsServiceNow → StackFlow

Step 4: Connect in StackFlow

  1. Navigate to Admin → Integration Hub → ServiceNow → Configure
  2. Enter the ServiceNow instance URL (e.g., https://your-org.service-now.com)
  3. Choose auth method: OAuth (recommended) or Basic Auth
  4. For OAuth: enter Client ID, Client Secret, and test credentials
  5. Configure the table mapping
  6. Set the sync schedule (default: every 5 minutes for incidents, every 1 hour for CMDB)
  7. Click Save & Test

Bidirectional CI and Incident Sync

The CMDB sync pulls CI records from ServiceNow's cmdb_ci table and creates/updates corresponding CIs in StackFlow's CMDB. The primary sync key is the ServiceNow sys_id, stored as an attribute on the StackFlow CI.

# Query StackFlow incidents by ServiceNow sys_id
curl -H "Authorization: Bearer $TOKEN"   "https://your-instance.stackflow-tech.com/prod/api/incidents?source=servicenow&external_id=SN_SYS_ID"

# Trigger a manual CMDB sync
curl -X POST   https://your-instance.stackflow-tech.com/prod/api/integrations/servicenow/sync-cmdb   -H "Authorization: Bearer $TOKEN"

Field Reference

FieldRequiredDescription
Instance URLYesServiceNow instance URL
Auth MethodYesoauth or basic_auth
Client ID / SecretOAuth onlyOAuth application registry credentials
Username / PasswordBasic onlyIntegration user credentials
Incident SyncNoEnable incident bidirectional sync (default: true)
CMDB SyncNoEnable CMDB CI sync from ServiceNow (default: true)
Sync Interval MinutesNoPull interval for polling sync (default: 5)

Testing the Integration

  1. Go to Admin → Integration Hub → ServiceNow → Test
  2. Click Test Connection — should return ServiceNow instance version and user info
  3. Click Sync 10 Recent Incidents to verify incident import
  4. Create an incident in StackFlow and verify it appears in ServiceNow within the sync interval

Troubleshooting

IssueCauseFix
OAuth token refresh failingClient secret expiredRegenerate in ServiceNow OAuth registry and update in Secrets Manager
Records not syncingACL blocking table accessGrant itil role or explicit table ACLs to integration user
CMDB sync very slowToo many CIs in queryAdd a filter in Integration Hub: active=true^sys_updated_on>=javascript:gs.hoursAgoStart(1)
Field mapping errorsCustom fields not in default schemaAdd custom field mappings in Integration Hub → ServiceNow → Field Mapping