ServiceNow Integration | Jeli
Connect Jeli and ServiceNow | Jeli Part of PagerDuty
ServiceNow + Jeli Benefits
Integrate Jeli and ServiceNow using the power of Jeli's webhooks and public API. With this integration you can:
- Automatically create a ticket in ServiceNow when an incident opens in Jeli.
- Trigger the creation of a Jeli incident from ServiceNow, moving from queue to coordination quickly and easily.
Requirements
Availability
Jeli is available on the Enterprise plan for Incident Management. Please contact our Sales Team to upgrade to an account plan with Jeli.
To Configure the Integration
In Jeli
- You will need a Jeli API access token to configure the integration. Only a Jeli Admin can generate an API access token.
In ServiceNow
- You must have a ServiceNow Administrator role to configure the integration.
How it Works
When a Jeli incident opens, it automatically sends a webhook to the ServiceNow instance. ServiceNow processes this webhook via the script included below, and creates a ServiceNow ticket. The Jeli incident details map to the ServiceNow ticket as follows:
- Short description: Jeli incident name
- Description: Jeli incident number and Slack Channel URL
- Jeli Incident ID: Jeli incident number
Users in ServiceNow can also create a Jeli incident from a ServiceNow ticket by using the Coordinate with Jeli button. ServiceNow then sends a request to the Jeli API to create a new Jeli incident.
Integration Walkthrough
Create a ServiceNow Ticket From a Jeli Incident
In ServiceNow
ServiceNow Version
The following instructions are based on ServiceNow Vancouver. Configuration in your specific ServiceNow version and instance may vary.
- Create a new Jeli Incident ID field for your Incident object in ServiceNow: Navigate to System Definition Tables. Search for and select Incident from the Tables list.
- Click New to add a new field to the Incident table and enter the following:
- Type: Integer
- Column label: Jeli incident ID
- Column name: u_jeli_incident_id
- Click Submit to create the field.
- Navigate to System Web Services Scripted REST APIs and click New.
- Create a new Scripted REST Service by providing a Name and API ID (e.g., "Jeli Incoming Webhooks").
- Click Submit to save.
- From your new Scripted REST Service, under the Resources tab, click New.
-
Enter the following information:
- Name: Open Incident
- HTTP Method: POST
- Relative path: /open
- Security tab: Uncheck
Requires authentication
- Script: Copy and paste the following script. You must replace
<YOUR JELI API KEY>
in thejeliApiKey
variable with your Jeli API key.
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var jeliApiKey = '<YOUR JELI API KEY>';
var requestData = request.body.data;
var jeliIncidentId = requestData.incidentId;
var responseMessage = '';
// Optionally make an API call to get additional incident details
jeliApiRequest = new sn_ws.RESTMessageV2();
jeliApiRequest.setEndpoint('https://api.jeli.io/v0/incident/' + jeliIncidentId);
jeliApiRequest.setHttpMethod('GET');
jeliApiRequest.setRequestHeader('Accept','application/json');
jeliApiRequest.setRequestHeader('Content-Type','application/json');
jeliApiRequest.setRequestHeader('Authorization', 'Bearer ' + jeliApiKey);
jeliApiResponse = jeliApiRequest.execute();
var jeliApiResponseJSON = new global.JSON().decode(jeliApiResponse.getBody());
var slackChannel = 'https://app.jeli.io/api/slack?channel=' + jeliApiResponseJSON.channel.id + '&team=' + jeliApiResponseJSON.slack_team_id;
// Look for an existing ticket in ServiceNow
var existingIncident = new GlideRecord('incident');
existingIncident.addQuery('u_jeli_incident_id', jeliIncidentId);
existingIncident.query();
// Update existing ticket
if(existingIncident.next()) {
existingIncident.description = 'Jeli Incident: ' + jeliIncidentId + '\n' + 'Slack Channel: ' + slackChannel;
existingIncident.u_jeli_incident_id = jeliIncidentId;
responseMessage = 'Ticket number ' + existingIncident.number + ' has been updated.';
}
else {
// Create new ticket
var newIncident = new GlideRecord('incident');
newIncident.initialize();
newIncident.short_description = requestData.name;
newIncident.description = 'Jeli Incident: ' + jeliIncidentId + '\n' + 'Slack Channel: ' + slackChannel;
newIncident.u_jeli_incident_id = jeliIncidentId;
newIncident.insert();
responseMessage = 'Ticket number ' + newIncident.number + ' has been created.';
}
response.setStatus(200);
var response_body = {
'response': responseMessage,
};
var writer = response.getStreamWriter();
writer.writeString(JSON.stringify(response_body));response.setContentType('application/json');
})(request, response);
- Click Submit to save.
- Navigate back to your newly created Scripted REST Service and copy the Resource path for your Open Incident resource (you’ll need this to configure the webhook in Jeli).
In Jeli
- In the Jeli web app, navigate to Settings Webhooks and select Add webhook.
- Create a new webhook with the following settings:
- Webhook URL:
https://<url of your servicenow instance>/<resource path from Step 8 above>
- For example, your webhook URL will look something like:
https://dev00000.service-now.com/api/1124078/jeli_incoming_webhooks/open
- For example, your webhook URL will look something like:
- Enabled Upon Creation: Enabled
- Event Type Filtering: Select
incident.created
- Webhook URL:
- Click Add to save the webhook configuration.
You can test the webhook by creating an incident in Jeli. You should see a newly created ServiceNow ticket.
Create a Jeli Incident From a ServiceNow Ticket
In ServiceNow
- Navigate to System UI UI Actions and select New.
- Configure the UI Action as follows:
Field | Value |
---|---|
Name | Coordinate with Jeli |
Table | Incident |
Action Name | Coordinate_with_Jeli |
Show insert | Disabled |
Show update | Enabled |
Client | Enabled |
Form button | Enabled |
Onclick | OpenJeliIncident() |
- In the Script field, copy and paste the following script. You must replace
<YOUR JELI API KEY>
in thejeliApiKey
variable with your Jeli API key. You will also need to update the values identified in the script below to set the desired Slack channel and incident opener.
Incident Opener
The email address used for the
email_of_incident_opener
variable must exist as a user in Jeli.
function OpenJeliIncident(){
gsftSubmit(null, g_form.getFormElement(), 'Coordinate_With_Jeli');//MUST call the 'Action name' set in this UI Action
}
if(typeof window == 'undefined')
callJeliAPI();
//Server-side function
function callJeliAPI(){
var jeliApiKey = '<YOUR JELI API KEY>'; // https://support.pagerduty.com/main/docs/jeli-api
// The values below are examples. You can hard code values here or
// you may use current.* to pull these values from the ServiceNow incident object
var email_of_incident_opener = '[email protected]';
var broadcast_channel = 'C032EFJTQ10';
var severity = '0';
var slack_team_id = 'T01NUHLDWC9';
var incident_stage = 'Investigating';
var requestBody = {};
requestBody.incident_name = current.short_description.toString();
requestBody.incident_stage = incident_stage;
requestBody.start_zoom = true;
requestBody.start_google_meet = false;
requestBody.email_of_incident_opener = email_of_incident_opener;
requestBody.broadcast_channels = [];
requestBody.broadcast_channels.push(broadcast_channel);
requestBody.severity_slack_command = severity;
requestBody.summary = 'TBD';
requestBody.slack_team_id = slack_team_id;
requestBody = new global.JSON().encode(requestBody);
incApiRequest = new sn_ws.RESTMessageV2();
incApiRequest.setEndpoint('https://api.jeli.io/v0/incident/');
incApiRequest.setHttpMethod('POST');
incApiRequest.setRequestHeader('Accept','application/json');
incApiRequest.setRequestHeader('Content-Type','application/json');
incApiRequest.setRequestHeader('Authorization', 'Bearer ' + jeliApiKey);
incApiRequest.setRequestBody(requestBody);
incApiResponse = incApiRequest.execute();
var responseJSON = new global.JSON().decode(incApiResponse.getBody());
current.u_jeli_incident_id = responseJSON.open_incident.vanity_id;
current.update();
action.setRedirectURL(current);
}
- Click Submit to save.
You will now see a Coordinate with Jeli button on your ServiceNow incident form. You can click this button to create an incident in Jeli and Slack. The Jeli incident ID will automatically populate in the ServiceNow record.
FAQ
Do updates from Jeli automatically appear in the ServiceNow ticket?
No, the provided script only creates a ServiceNow ticket when a Jeli incident is created.
Updated 25 days ago