Admin access to create integration users and OAuth providers
ServiceNow version
Madrid (2019) or later
StackFlow role
super_admin
Network
HTTPS access from StackFlow Lambda VPC to ServiceNow instance URL
Step 1: Create ServiceNow Integration User
In ServiceNow, navigate to User Administration → Users → New
Create user stackflow-integration with role itil and rest_api_explorer
Set a strong password and note the username/password for Basic Auth, OR proceed to Step 2 for OAuth
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
In ServiceNow, go to System OAuth → Application Registry → New
Select Create an OAuth API endpoint for external clients
Set the name to StackFlow OAuth
Generate a Client ID and Client Secret
Set the redirect URL to: https://your-instance.stackflow-tech.com/auth/servicenow/callback
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 Table
StackFlow Module
Sync Direction
incident
Incidents
Bidirectional
problem
Problems
Bidirectional
change_request
Changes
Bidirectional
sc_request
Service Requests
ServiceNow → StackFlow
cmdb_ci
CMDB CIs
ServiceNow → StackFlow (read-only)
cmdb_rel_ci
CMDB Relationships
ServiceNow → StackFlow
Step 4: Connect in StackFlow
Navigate to Admin → Integration Hub → ServiceNow → Configure
Enter the ServiceNow instance URL (e.g., https://your-org.service-now.com)
Choose auth method: OAuth (recommended) or Basic Auth
For OAuth: enter Client ID, Client Secret, and test credentials
Configure the table mapping
Set the sync schedule (default: every 5 minutes for incidents, every 1 hour for CMDB)
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"