Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Need help? Contact us:

 

The ServiceNow adapter is designed to provide a template for getting started with ServiceNow integrations, including:

  1. Authenticating with the ServiceNow API via OAuth2.0 (JWT)

  2. Creating and retrieving Incident table records in ServiceNow

This component can be customized and adapted according to your workflow needs. For example, it could be adapted as a Notifications component that integrates Iguana notifications with an existing support workflow. The ServiceNow Rest API Explorer is useful for reviewing the available API endpoints.

Component Setup:

 Login or sign up for a ServiceNow Developer Account and create an Iguana App

Refer to Set up a ServiceNow Developer Sandbox for the ServiceNow sign up and application set up required in order to gather the authentication details needed for the ServiceNow Adapter.

 Import the ServiceNow Notifier component

See Create a Component if this is your first time!

 Configure your domain and authentication details in the ServiceNow Notifier Custom Fields
  • Domain: the ServiceNow Instance ID from your developer account, ex. domain.service-now.com.

  • PrivateKey: private key previously generated to be used for signing the JWT.

  • ClientID and ClientSecret supplied by the ServiceNow application endpoint.

  • Kid: the kid (key id) from the JWT Verifier Maps ServiceNow table.

  • UserField: must match what was configured in the JWT (ex. if UserField = Email, this is the user's email address).

Using the information provided, the ServiceNow component will run through the authentication workflow and store the returned access token and expiry time in an encrypted file for use on subsequent API requests.

image-20240417-151435.png

 Start the component or open the Translator to create the ticket and view the results
  1. Start the ServiceNow component or open the Translator to run the script. If running the script from the Translator, you will need to set the createTbRecord function call’s live parameter to true for the function to execute when viewing from the Translator

    image-20240417-180922.png
  2. If running the script from within the Translator, you can check the created ticket from the results of the getTbRecord function

    image-20240417-180735.png
  3. In ServiceNow, go to Service Desk > Incidents to see the resulting ticket!

image-20240417-153159.png

The SERVICENOW Library:

 SERVICENOWclient - sets up the adapter framework

Sets up the ServiceNow Adapter framework, adding the method modules to a metatable and storing the configurations from the custom fields in a table to call the API.

 SERVICENOWcustom - makes API requests and returns the response

SERVICENOWcustom takes in any API requests and parameters to make the API call and return the response.

  • First, the function checks if the token key exists or is still valid (based on the key_expiry). If not, it calls SERVICENOWauth to perform the OAuth2.0 authentication workflow to obtain the token to be used in subsequent requests.

  • Uses the passed configurations API request parameters - the method (ex. post), ServiceNow API endpoint (ex. 'now/table/') and parameters for the call (ex. the incident ticket) - to build and carry out the appropriate HTTP request.

 auth/SERVICENOWauth - authenticates with the ServiceNow API authorization endpoint /oauth_token.do

The SERVICENOWauth function builds and makes the HTTP POST token request to obtain the access token required for any resource requests against the FHIR Server.

A separate SERVICENOWcreateJWT function creates the JSON Header and Payload components of the JWT and calls SERVICENOWjwt to sign and return the JWT required for the token request.

If the token requests is successful (HTTP 200 response), the token and token expiry returned are stored in the adapter object (key and key_expiry) and saved in an encrypted file via SERVICENOWencrypt.

 auth/SERVICENOWencrypt - stores and encrypts the API token and token expiry

SERVICENOWencrypt provides localized https://interfaceware.atlassian.net/wiki/x/EQCeqg functionality via save and load functions that encrypt and decrypt the provided API token and expiry time in an external file. This allows the token to be reused for subsequent API calls.

 auth/SERVICENOWjwt - takes the provided parameters and private key to generate and sign the JWT token

SERVICENOWjwt provides localized OAUTH Library functionality. It takes the provided JWT header, JWT payload, signing algorithm, and private key to generate and sign the JWT token.

 methods/SERVICENOWcreateTbRecord - prepares arguments for SERVICENOWcustom to create an incident ticket

SERVICENOWcreateTbRecord prepares the arguments and calls SERVICENOWcustom to create an incident ticket in ServiceNow via HTTP POST request.

 methods/SERVICENOWgetTbRecord - prepares arguments for SERVICENOWcustom to retrieve an incident ticket

SERVICENOWgetTbRecord prepares the arguments and calls SERVICENOWcustom to retrieve an incident ticket in ServiceNow via HTTP GET request.

 

  • No labels