Connecting Amazon Q Business to ServiceNow using APIs - Amazon Q Business

Connecting Amazon Q Business to ServiceNow using APIs

You use the CreateDataSource action to connect a data source to your Amazon Q application.

Then, you use the configuration parameter to provide a JSON schema with all other configuration information specific to your data source connector.

For an example of the API request, see CreateDataSource in the Amazon Q API Reference.

ServiceNow configuration properties

The following provides information about important configuration properties required in the schema.

Configuration Description Type Required

connectionConfiguration

Configuration information for the endpoint for the data source.

object

This property has the following sub-property: repositoryEndpointMetadata.

Yes

repositoryEndpointMetadata

The endpoint information for the data source.

object

This property has the following sub-property: teamId.

Yes

hostUrl

The ServiceNow host URL. For example, your-domain.service-now.com.

string

Yes

authType

The type of authentication you are using, either basicAuth or OAuth2.

string

Yes

servicenowInstanceVersion

The ServiceNow version you are using. You can choose between Tokyo, San Diego, Rome, Vancouver, and Others.

string

Yes

repositoryConfigurations

Configuration information for the content of the data source. For example, configuring specific types of content and field mappings.
  • knowledgeArticle

  • attachment

  • serviceCatalog

  • incident

A list of ServiceNow objects that Amazon Q crawls and maps the attributes of to Amazon Q index field names.

object

This property has the following sub-properties: indexFieldName, indexFieldType, dataSourceFieldName, and dateFieldFormat.

Yes

indexFieldName

The field name of your ServiceNow pages and assets.

string

Yes

indexFieldType

The field type of your ServiceNow pages and assets.

string

The allowed values are STRING, STRING_LIST, DATE, and LONG.

Yes

dataSourceFieldName

The data source field name of your ServiceNow pages and assets.

string

Yes

dateFieldFormat

The date format of your ServiceNow pages and assets.

string

Specify the date format in the form yyyy-MM-dd'T'HH:mm:ss'Z'

No

additionalProperties

Additional configuration options for your content in your data source.

object

This property has the following sub-properties.

  • applyACLForKnowledgeArticle

  • applyACLForServiceCatalog

  • applyACLForIncident

  • isCrawlKnowledgeArticle

  • isCrawlKnowledgeArticleAttachment

  • includePublicArticlesOnly

  • knowledgeArticleFilter

  • knowledgeArticleTitleRegExp

  • isCrawlServiceCatalog

  • isCrawlServiceCatalogAttachment

  • isCrawlActiveServiceCatalog

  • isCrawlInactiveServiceCatalog

  • serviceCatalogQueryFilter

  • serviceCatalogTitleRegExp

  • isCrawlIncident

  • isCrawlIncidentAttachment

  • isCrawlActiveIncident

  • isCrawlInactiveIncident

  • incidentStateType

  • incidentQueryFilter

  • incidentTitleRegExp

  • maxFileSizeInMegaBytes

  • inclusionFileTypePatterns

  • exclusionFileTypePatterns

  • inclusionFileNamePatterns

  • exclusionFileNamePatterns

Yes

maxFileSizeInMegaBytes

Specify the file size limit in MBs that Amazon Q will crawl. Amazon Q will crawl only the files within the size limit you define. The default file size is 50MB. The maximum file size should be greater than 0MB and less than or equal to 50MB.

string

No
  • knowledgeArticleFilter

  • incidentQueryFilter

  • serviceCatalogQueryFilter

Specify specific knowledge articles, incident queries, and service catalog queries to crawl.

string

No

incidentStateType

Specify incidents to crawl by state type: whether Open, Open - Unassigned, Resolved, or All.

array (string)

No
  • knowledgeArticleTitleRegExp

  • serviceCatalogTitleRegExp

  • incidentTitleRegExp

A list of regular expression patterns to include and exclude specific files in your ServiceNow data source. Files that match the patterns are included in the index. Files that don't match the patterns are excluded from the index. If a file matches both an inclusion and exclusion pattern, the exclusion pattern takes precedence and the file isn't included in the index.

string

No
  • exclusionFileTypePatterns

  • exclusionFileNamePatterns

A list of regular expression patterns to exclude specific content in your ServiceNow data source. Content that matches the patterns are excluded from the index. Content that doesn't match the patterns are included in the index. If any content matches both an inclusion and exclusion pattern, the exclusion pattern takes precedence, and the content isn't included in the index.

array (string)

No
  • inclusionFileTypePatterns

  • inclusionFileNamePatterns

A list of regular expression patterns to include specific content in your ServiceNow data source. Content that matches the patterns are included in the index. Content that doesn't match the patterns are excluded from the index. If any content matches both an inclusion and exclusion pattern, the exclusion pattern takes precedence, and the content isn't included in the index.

array (string)

No
  • isCrawlKnowledgeArticle

  • isCrawlKnowledgeArticleAttachment

  • includePublicArticlesOnly

  • isCrawlServiceCatalog

  • isCrawlServiceCatalogAttachment

  • isCrawlActiveServiceCatalog

  • isCrawlInactiveServiceCatalog

  • isCrawlIncident

  • isCrawlIncidentAttachment

  • isCrawlActiveIncident

  • isCrawlInactiveIncident

  • applyACLForKnowledgeArticle

  • applyACLForServiceCatalog

  • applyACLForIncident

Specify true to index ServiceNow knowledge articles, service catalogs, incidents, and attachments and their ACLs.

boolean

No

type

The type of data source. We recommend that you use SERVICENOWV2 as your data source type.

string

Valid values are SERVICENOWV2 and SERVICENOW.

Yes

enableIdentityCrawler

true to activate identity crawler. Identity crawler is activated by default. Crawling identity information on users and groups with access to specific documents is useful for user context filtering. Search results are filtered based on the user or their group access to documents.

Note

Amazon Q Business crawls identity information from your data source by default to ensure responses are generated only from documents end users have access to. For more information, see Identity crawler.

boolean

No

syncMode

Specify whether Amazon Q should update your index by syncing all documents or only new, modified, and deleted documents.

string

You can choose between the following options:

  • Use FORCED_FULL_CRAWL to freshly re-crawl all content and replace existing content each time your data source syncs with your index.

  • Use FULL_CRAWL to incrementally crawl only new, modified, and deleted content each time your data source syncs with your index.

Yes

secretARN

The Amazon Resource Name (ARN) of an AWS Secrets Manager secret that contains the key-value pairs required to connect to your ServiceNow.

string

The secret must contain a JSON structure with the following keys:

{ "username": "user name", "password": "password" }

If you use OAuth2 authentication, your secret must contain a JSON structure with the following keys:

{ "username": "user name", "password": "password", "clientId": "client id", "clientSecret": "client secret" }
Yes

version

The version of the template that's currently supported.

string

No

ServiceNow JSON schema

The following is the ServiceNow JSON schema:

{ "type": "object", "properties": { "type": { "type": "string", "enum": ["SERVICENOWV2", "SERVICENOW"] }, "syncMode": { "type": "string", "enum": ["FORCED_FULL_CRAWL", "FULL_CRAWL"] }, "secretArn": { "type": "string", "minLength": 20, "maxLength": 2048 }, "enableIdentityCrawler": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "connectionConfiguration": { "type": "object", "properties": { "repositoryEndpointMetadata": { "type": "object", "properties": { "hostUrl": { "type": "string", "pattern": "^(?!(^(https?|ftp|file):\\/\\/))[a-z0-9-]+(.service-now.com|.servicenowservices.com)$", "minLength": 1, "maxLength": 2048 }, "authType": { "type": "string", "enum": ["basicAuth", "OAuth2"] }, "servicenowInstanceVersion": { "type": "string", "enum": ["Tokyo", "Sandiego", "Rome", "Vancouver", "Others"] } }, "required": ["hostUrl", "authType", "servicenowInstanceVersion"] } }, "required": ["repositoryEndpointMetadata"] }, "repositoryConfigurations": { "type": "object", "properties": { "knowledgeArticle": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": ["STRING", "DATE", "STRING_LIST"] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": ["fieldMappings"] }, "attachment": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": ["STRING", "LONG", "DATE", "STRING_LIST"] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": ["fieldMappings"] }, "serviceCatalog": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": ["STRING", "DATE", "STRING_LIST"] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": ["fieldMappings"] }, "incident": { "type": "object", "properties": { "fieldMappings": { "type": "array", "items": [ { "type": "object", "properties": { "indexFieldName": { "type": "string" }, "indexFieldType": { "type": "string", "enum": ["STRING", "DATE", "STRING_LIST"] }, "dataSourceFieldName": { "type": "string" }, "dateFieldFormat": { "type": "string", "pattern": "yyyy-MM-dd'T'HH:mm:ss'Z'" } }, "required": [ "indexFieldName", "indexFieldType", "dataSourceFieldName" ] } ] } }, "required": ["fieldMappings"] } } }, "additionalProperties": { "type": "object", "properties": { "maxFileSizeInMegaBytes": { "type": "string" }, "isCrawlKnowledgeArticle": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlKnowledgeArticleAttachment": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "includePublicArticlesOnly": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "knowledgeArticleFilter": { "type": "string" }, "incidentQueryFilter": { "type": "string" }, "serviceCatalogQueryFilter": { "type": "string" }, "isCrawlServiceCatalog": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlServiceCatalogAttachment": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlActiveServiceCatalog": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlInactiveServiceCatalog": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlIncident": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlIncidentAttachment": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlActiveIncident": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "isCrawlInactiveIncident": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "applyACLForKnowledgeArticle": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "applyACLForServiceCatalog": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "applyACLForIncident": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ] }, "incidentStateType": { "type": "array", "items": { "type": "string", "enum": ["Open", "Open - Unassigned", "Resolved", "All"] } }, "knowledgeArticleTitleRegExp": { "type": "string" }, "serviceCatalogTitleRegExp": { "type": "string" }, "incidentTitleRegExp": { "type": "string" }, "inclusionFileTypePatterns": { "type": "array", "items": { "type": "string" } }, "exclusionFileTypePatterns": { "type": "array", "items": { "type": "string" } }, "inclusionFileNamePatterns": { "type": "array", "items": { "type": "string" } }, "exclusionFileNamePatterns": { "type": "array", "items": { "type": "string" } }, "enableDeletionProtection": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": ["true", "false"] } ], "default": false }, "deletionProtectionThreshold": { "type": "string", "default": "15" } }, "required": [] }, "version": { "type": "string", "anyOf": [ { "pattern": "1.0.0" } ] }, "required": [ "type", "syncMode", "secretArn", "connectionConfiguration", "repositoryConfigurations", "additionalProperties" ] } }

ServiceNow JSON schema example

The following is the ServiceNow JSON schema example:

{ "type": "SERVICENOWV2", "syncMode": "FULL_CRAWL", "secretArn": "arn:aws:secretsmanager:us-west-2:123456789012:secret:my-servicenow-secret", "enableIdentityCrawler": "true", "connectionConfiguration": { "repositoryEndpointMetadata": { "hostUrl": "mycompany.service-now.com", "authType": "basicAuth", "servicenowInstanceVersion": "Tokyo" } }, "repositoryConfigurations": { "knowledgeArticle": { "fieldMappings": [ { "indexFieldName": "article_id", "indexFieldType": "STRING", "dataSourceFieldName": "id", "dateFieldFormat": "yyyy-MM-dd'T'HH:mm:ss'Z'" } ] }, "attachment": { "fieldMappings": [ { "indexFieldName": "attachment_id", "indexFieldType": "STRING", "dataSourceFieldName": "id", "dateFieldFormat": "yyyy-MM-dd'T'HH:mm:ss'Z'" } ] }, "serviceCatalog": { "fieldMappings": [ { "indexFieldName": "catalog_item_id", "indexFieldType": "STRING", "dataSourceFieldName": "id", "dateFieldFormat": "yyyy-MM-dd'T'HH:mm:ss'Z'" } ] }, "incident": { "fieldMappings": [ { "indexFieldName": "incident_id", "indexFieldType": "STRING", "dataSourceFieldName": "id", "dateFieldFormat": "yyyy-MM-dd'T'HH:mm:ss'Z'" } ] } }, "additionalProperties": { "maxFileSizeInMegaBytes": "50", "isCrawlKnowledgeArticle": "true", "isCrawlKnowledgeArticleAttachment": "true", "includePublicArticlesOnly": "false", "knowledgeArticleFilter": "filter_condition", "incidentQueryFilter": "incident_condition", "serviceCatalogQueryFilter": "service_catalog_condition", "isCrawlServiceCatalog": "true", "isCrawlServiceCatalogAttachment": "true", "isCrawlActiveServiceCatalog": "true", "isCrawlInactiveServiceCatalog": "false", "isCrawlIncident": "true", "isCrawlIncidentAttachment": "false", "isCrawlActiveIncident": "true", "isCrawlInactiveIncident": "false", "applyACLForKnowledgeArticle": "true", "applyACLForServiceCatalog": "true", "applyACLForIncident": "true", "incidentStateType": ["Open", "Resolved"], "knowledgeArticleTitleRegExp": ".*", "serviceCatalogTitleRegExp": ".*", "incidentTitleRegExp": ".*", "inclusionFileTypePatterns": ["*.pdf", "*.docx"], "exclusionFileTypePatterns": ["*.tmp"], "inclusionFileNamePatterns": ["important-*"], "exclusionFileNamePatterns": ["temporary-*"], "enableDeletionProtection": "false", "deletionProtectionThreshold": "15" } }