logo

NJP

A Practical Use for Setting Up Jira to ServiceNow Bi-Directional Integration with Webhooks

New article articles in ServiceNow Community · Jan 27, 2025 · article

How to Set Up Tested Jira to ServiceNow Bi-Directional Integration with Webhooks: Triggered by Jira Issue Creation or Comments - A Practical Use Case

I’ve recently tested and successfully implemented Jira to ServiceNow bi-directional integration in my PDI environment using Jira Webhooks, and I thought I’d share my findings with the ServiceNow community and my LinkedIn network. This integration not only allowed me to sync Jira Issues with ServiceNow Incidents but also provided me with hands-on experience in using Flow Designer to manage the data flow and avoid common pitfalls such as duplicate incident creation and looping comments.

In this article, I’ll walk you through a step-by-step guide on setting up Jira to ServiceNow bi-directional webhooks, demonstrating a simple use case of syncing Jira issues and updating the corresponding ServiceNow incidents. This integration ensures that:

  1. If a Jira issue is created and the issue ID doesn’t exist in ServiceNow, a new incident is created with the Jira issue’s summary and description.
  2. If the Jira issue ID is already present in ServiceNow, comments from Jira are automatically added to the existing ServiceNow incident.

Use Case Scenario: Syncing Jira Issues with ServiceNow

My use case focused on syncing Jira issues with ServiceNow incidents. Here's a brief overview of the workflow:

  • Create Incident in ServiceNow: When a new Jira issue is created and the issue ID is not already found in ServiceNow, a new incident is created using the Jira issue's summary and description.
  • Update Existing Incident: If the Jira issue ID already exists in ServiceNow, any new comments added to the Jira issue will be appended to the corresponding ServiceNow incident.

Flow Trigger: When a Jira Issue is Created or Commented

The flow between Jira and ServiceNow is triggered by two main events:

  1. Jira Issue Created: When a new issue is created in Jira, the flow is activated. The flow will check if the issue ID already exists in ServiceNow. If it doesn’t, a new incident is created using the Jira issue’s details.
  2. Jira Issue Commented: When a comment is added to an existing Jira issue, the flow triggers again. This ensures that any new comments are synchronized and appended to the corresponding ServiceNow incident.

By setting up webhooks to monitor both issue creation and comments in Jira, the flow ensures that both Jira and ServiceNow stay in sync, with data automatically updated on both sides.

This integration gave me valuable experience in managing workflows in Flow Designer. Initially, I faced challenges such as duplicate incident creations when syncing the Jira issue ID, as well as comments getting stuck in a loop between Jira and ServiceNow. However, after digging deep into the configuration and experimenting with various methods, I was able to resolve these issues and fine-tune the flow to avoid such pitfalls.

Prerequisites

Before starting, ensure the following:

  • You have admin access to both Jira and ServiceNow.
  • Your ServiceNow instance has the required API permissions enabled.
  • Your Jira instance is properly configured for webhook integration.

Steps for Configuring Jira Bi-Directional Webhooks

1. Create a Token for Jira Webhook URL

To secure the integration, you need a token that will be embedded in the Jira webhook URL.

  • Navigate to Token Verification in ServiceNow.
  • In the navigation filter, type: token_verification.LIST.
  • Click New to create a token.
  • Provide a name for the token and click Save.

selvarun_0-1737994265862.png

2. Register Jira Webhook in ServiceNow

Now, let’s set up the webhook in ServiceNow.

  • Navigate to Jira Webhooks > Jira Webhook Registries in your ServiceNow instance.
  • The token you created in Step 1 will automatically populate here.
  • Copy the Callback URL and note it down for use in Jira.

selvarun_1-1737994265864.png

3. Create a Webhook in Jira

Next, you need to create a webhook in your Atlassian Jira instance:

  • Go to Jira Administration Console > System > Webhooks (under the Advanced section).
  • Alternatively, use the quick search and type webhooks.
  • Click Create a Webhook.
  • In the form, enter the necessary details for the new webhook, such as:
    • Name: Choose a meaningful name for the webhook.
    • URL: Paste the Callback URL you copied earlier from ServiceNow.
    • Events: Select the types of events you want to trigger from Jira, such as Issue Created, Issue Updated, or Issue Commented.

selvarun_2-1737994265868.png

selvarun_3-1737994265874.png

4. Customize the Webhook in ServiceNow

To make sure the data from Jira is properly processed in ServiceNow:

  • Go to Jira Webhook Routing Policies in ServiceNow.
  • Configure the routing conditions based on your requirements, for example, whether the Jira issue is a bug, task, or improvement.
  • Modify the Process Jira Webhook subflow in Flow Designer by copying it, giving it your own name, and then modifying it as per your requirements. Once the flow is ready, go to the properties of the flow and change the 'Run as' field to 'System User' to ensure the data flows correctly between Jira and ServiceNow.

selvarun_4-1737994265879.png

selvarun_5-1737994265882.png

selvarun_6-1737994265885.png

selvarun_7-1737994265888.png

selvarun_8-1737994265891.png

selvarun_9-1737994265893.png

5. Test the Integration

To ensure everything is set up correctly, test the integration with the following scenarios:

  1. Test Scenario 1: Create a new Jira issue and verify if a new ServiceNow incident is created automatically, using the issue summary and description.
  2. Test Scenario 2: Update the Jira issue with a comment and verify if the comment is added to the corresponding ServiceNow incident.
  3. Test Scenario 3: Test with existing Jira issues to see if comments are added without creating duplicate incidents.

Please find the attached document for the screenshots.

Handling Common Pitfalls

During my testing, I encountered some issues that are commonly faced in such integrations, especially with avoiding duplicate incident creation and ensuring comments flow smoothly between the two platforms. Here's how I addressed them:

  • Duplicate Incident Creation: To avoid creating duplicate incidents, I implemented a check in Flow Designer to ensure that the Jira issue ID is verified before creating a new incident.
  • Comment Looping: The comment synchronization was getting stuck in a loop, where comments from Jira were being sent to ServiceNow after creation for an incident. I fixed this by adding conditions to prevent update from being sent back to ServiceNow if the comment was contained ‘Acknowledged the JIRA ticket and new incident has been created with’ due to step 10.

For more information about infinite loop, please check: Comments syncing multiple times in ServiceNow to Jira Bi-Directional integration - Support and Troubleshooting

https://support.servicenow.com/kb?id=kb%5Farticle%5Fview&sysparm%5Farticle=KB0831019

Conclusion

Integrating Jira with ServiceNow using bi-directional webhooks has been a fantastic learning experience for me. Not only did I improve my Flow Designer skills, but I also gained a deeper understanding of how webhooks and data flow work between these two platforms.

If you're interested in a unidirectional ServiceNow to Jira integration, I’ve shared more details in my [LinkedIn post]( https://www.linkedin.com/posts/selvarun%5Fjira-integration-with-servicenow-using-jira-activity-7287200899494494208-e-BO?utm%5Fsource=share&utm%5Fmedium=member%5Fdesktop).

For those of you who want to implement this or have experience in doing so, I would love to hear your feedback and suggestions. Feel free to share your thoughts or improvements in the comments below!

If you believe the solution provided has adequately addressed your query, could you please **mark it as 'Helpful'**. This will help other community members who might have the same question find the answer more easily.

Thank you for your consideration.

Selva Arun

View original source

https://www.servicenow.com/community/developer-articles/a-practical-use-for-setting-up-jira-to-servicenow-bi-directional/ta-p/3160262