Enable bidirectional comments between APEX AIOps Incident Management and ServiceNow
Bidirectional comments make it possible to synchronize the comments between ServiceNow and APEX AIOps Incident Management. The following procedures explain how to configure bidirectional comments.
Important
Before starting setting up bidirectional comments support, you must first complete the steps for manual configuration using incident workflows and webhook endpoints.
After setting up communication between ServiceNow and Incident Management, you must complete two procedures (included below) to enable bidirectional comments:
Configure a new incident webhook endpoint in Incident Management
Configure an incident workflow in Incident Management
Configure a new incident webhook endpoint in Incident Management
Begin by creating a new incident webhook endpoint called ServiceNowComments which forwards comments as work_notes
to ServiceNow.
Log in to Incident Management and navigate to Integrations > Outbound Integrations > Webhook Endpoint > Incident Webhook Endpoint.
At the far right side of the "ServiceNowCreate" webhook endpoint you configured previously, click the copy icon:
Enter "ServiceNowComments" as the name of the webhook endpoint and then click Duplicate.
Click the "ServiceNowComments" webhook endpoint to open it for editing.
Make the changes to the webhook endpoint as indicated while leaving the other settings as they are:
Triggers
Enable the Comments updated trigger.
Payload Body
Copy and paste the following into the Key/Value Editor box, replacing the existing text:
{ "u_inc_id": "${id}", "u_payload": '{"work_notes":"${last_comment.created_by}: ${last_comment.comment}"}', "sysparm_action":"update", "u_snc_id": "${outbound.ServiceNowMgmt.external_id}" }
In this payload, the email address of the user that added the comment is prefixed to the
work_note
in ServiceNow. This can be customized as required.
Configure an incident workflow in Incident Management
Next, add a new incident workflow called "Add comments to ServiceNow" to trigger the new webhook endpoint.
Navigate to Correlate & Automate > Workflow Engine > Incident Workflows.
Click Add Workflow and enter "Add comments to ServiceNow" as the name of the workflow. Optionally, provide a description.
For the Trigger, select Changed incidents only.
In the Filter, add a new filter condition:
changes in (comments) AND originator != <external_user_email>
This filter accomplishes two things:
changes in (comments)
causes the workflow to trigger only when updates are made to commentsoriginator != <external_user_email>
is required for loop prevention. The <external_user_email> is the email address associated with the Incident Management API key configured in ServiceNow.
Click Add Action, select the Send to Endpoint action and then click Add Selected Action.
Select the new Send to Endpoint action and edit the three sections indicated. Skip the other sections.
Webhook: Select the "ServiceNowComments" incident webhook endpoint that you created earlier.
External Link: Skip this section.
Integration Name: "ServiceNowMgmt"
Save and Enable the workflow.