ServiceNow

  1. Go to your YellowAnt Dashboard (yoursubdomain.yellowant.com) or head over to the YellowAnt Marketplace.

  2. In the search bar, look for "ServiceNow" or simply click the icon. If you have already integrated the application, you will be able to see it under "My Applications".

3. Once you find the application either in the dashboard or on the Marketplace click on Integrate. You will be taken to a page where you'll find the integrate option/button. Click on the integrate button.

4. You will be on the integration page which prompts you to add an account to the application. Click add account which takes you to the ServiceNow OAuth page. Note: Select a team before you click "+ ADD ACCOUNT".

Select "Add Account"

5. Allow the needed permissions to ServiceNow.

6. Select "Integrate". YellowAnt will ask you to fill in a few details

Fill in the details of your ServiceNow Account

To find the values for these fields, follow these steps:

(i) Open Application registry in System OAuth in your ServiceNow Instance. Click on "New" and then "Connect to a third party OAuth Provider"

OAuth for ServiceNow Integration

(ii) Click on Create an OAuth API endpoint for external clients. Enter your application name

We are naming this "YellowAnt"

(iii) Copy the Client ID and the Client Secret. Set the Access token and Refresh token lifespan to some high value Click on Submit. The redirect URL needs to filled with the value: https://www.yellowant.com/market/applications/1930/service-now-auth/

Use these details to integrate your YellowAnt App

7. Enter the Instance name,Client ID and Client secret which was copied earlier. Click "Allow" in your ServiceNow instance

Click Allow to complete Integration

8. YellowAnt will send you a message with available functions. Run "Generate Webhooks". A webhook will be generated in your chat console

Webhooks in Slack
Webhooks in Microsoft Teams

9. In your ServiceNow instance, open "Business Rules" and click "New".

10. Enter a Name for the new webhooks rule. Choose the table as "Incident" .Select" Advanced Checkbox". Select "after" from the "When" dropdown. Select "Insert". In Role conditions select web_service_admin.

11. Go to the "Advanced" tab and paste this code:

(function executeRule(current, previous /*null when async*/) {
try {
var webhook_id="//Your Webhook ID"
var r = new sn_ws.RESTMessageV2();
r.setEndpoint("https://www.yellowant.com/market/applications/1930/webhooks/"+webhook_id);
body ='{' +
'"state"' + ':' + '"' + "created"+'"' + ',' +
'"sys_id"' + ':' + '"'+current.sys_id+'"' + ',' +
'"number"' + ':' + '"'+current.number+'"' + ',' +
'"assigned_to"' + ':' + '"'+current.assigned_to+'"' + ',' +
'"description"' + ':' + '"'+current.short_description+'"' + ',' +
'"assigned_to"' + ':' + '"'+current.assigned_to+'"'
+ '}';
r.setRequestBody(body);
r.setHttpMethod("POST");
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.getMessage();
}
})(current, previous);
‚Äč

12. Your ServiceNow integration is now complete.