- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
01-27-2025 08:15 AM - edited 01-27-2025 08:19 AM
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:
- 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.
- 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:
- 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.
- 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.
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.
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.
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.
5. Test the Integration
To ensure everything is set up correctly, test the integration with the following scenarios:
- Test Scenario 1: Create a new Jira issue and verify if a new ServiceNow incident is created automatically, using the issue summary and description.
- Test Scenario 2: Update the Jira issue with a comment and verify if the comment is added to the corresponding ServiceNow incident.
- 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 Troub...
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=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_jira-integration-with-servicenow-using-jira-activity-7287200...).
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
- 7,096 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Selva Arun
We have implemented something similar, but in our case, we are creating projects which is successful. But now the challenge is, we are struggling to update the users from servicenow to Jira.
Can you give an example/show of how we can do that ? There is an action available "Look up user stream by name", we are trying to use it, but no luck till now.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Akash Srivasta2 ,
Thanks for reaching out! Glad to hear your project creation integration is working well.
For updating users from ServiceNow to Jira, you’re right—the “Look up user stream by name” action can be a bit tricky. Here’s a general approach you can try:
- Use the “Look up user stream by name” action to retrieve the Jira user based on their name or email from ServiceNow.
- Check the output of that action to ensure you’re getting the correct user details (like the Jira user ID).
- Use the “Update user” action (or the appropriate REST API call) to update the user’s information in Jira, using the user ID you retrieved.
If you’re not getting results from the “Look up user stream by name” action, double-check:
- The exact value you’re passing (it may need to be the username or email, depending on your Jira setup).
- That the user exists in Jira and is accessible via the API.
- Any permissions or API token issues.
If you can share a screenshot of your flow or the error message you’re seeing, I can give more specific guidance or an example.
Let me know, and I’ll be happy to help further!
Best,
Selva
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @Selva Arun
Sure, So I created a copy of Datastream "Look Up users by username", while testing I am giving the credentials since we have setup OAuth authentication.
But for some reasons, It is not giving us the outputs, even if we are giving the right username or email ID. Below is how the output looks like.... Its all empty
When checking the logs, For the datastream, I see one error message...
{"errorMessages":["The query parameter 'username' is not supported in GDPR strict mode."],"errors":{}} and status code is 400...
Can you suggest how we should fix this ??