Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira + ChatGPT: How to Automatically Triage Jira Tickets with Artificial Intelligence

Felipe Lucena
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 31, 2023

Artificial intelligence is becoming more prevalent in our daily lives, with OpenAI's ChatGPT being one of the standout examples. Since its launch, I have dedicated a significant amount of time to studying it.

As I am a Jira administrator, I decided to integrate ChatGPT with Jira Service to automate ticket triage with OpenAI's artificial intelligence.

In this article, even if you're not a developer, you will learn:

  1. Why delegate triage to an AI
  2. Requirements for Automatic Ticket Triage
  3. Prompt to triage and analyze sentiment in Jira
  4. How You Can Integrate Jira Service with ChatGPT (Step by Step)
  5. Costs and Savings Generated
  6. Future of AI ticket triage

And if you still have questions by the end, you can reach out to me directly to continue the conversation.

12.png

🤔 Why delegate triage to an AI?

 

Triaging tickets manually can be a time-consuming and error-prone task, and by delegating this function to an AI, companies can benefit in several ways:

  • Accuracy: AI analyzes tickets based on defined criteria, eliminating human errors.
  • Efficiency: Calls are sorted in seconds, streamlining the service process.
  • Workload Reduction: With AI taking care of the triage, teams can focus on more complex and strategic tasks.

In the image below, you can see ChatGPT filling in the Sentiment, Service, and Sentiment Reason fields automatically:

 

jira_and_chatgpt.gif

 

📋 Requirements for Automatic Ticket Triage with ChatGPT

 

During the configuration of the ChatGPT integration, I specified that the AI must complete the following fields:

  1. Sentiment [Select Field]: ChatGPT will discern whether the sentiment expressed by the requester is Positive, Negative or Neutral.
  2. Service [Select Field]: ChatGPT will identify the service category associated with the customer's issue or feedback.
  3. Sentiment Reason [Paragraph Field]: ChatGPT will provide the rationale for the sentiment selection.

 

📊 Hey, can you imagine how many reports you can do with this here?* 😉

marshal.gif

 

💬 Prompt to triage sentiment analysis of Jira tickets

Now that we know what the requirements are for our automatic ticket triage, it's time to create a prompt in ChatGPT that answers all these questions. For this purpose, we will use the prompt below:

commented_prompt.png

 

The prompt above is clear about its purpose, but I've highlighted three important sections of the image above. Are they:

  1. I put all available options in the Service field of my Jira project to ensure that ChatGPT always selects a valid option in Jira.
    service_custom_field.png
  2. I requested that the result be returned in JSON format to save with requests for queries in the ChatGPT API.
  3. I made it clear that ChatGPT must consider the ticket description that is between the <description></description> delimiters.

 

When running a real case directly in the ChatGPT console, I get a response like the one below:

json_chatgpt.png

 

✅ You can see this prompt in the GitHub repository at this link: https://bit.ly/ticket-triage-prompt-in-jira

 

 

🤖 How to integrate Jira with ChatGPT (step by step)

What do you need to do the integration?

Integrating Jira Service with ChatGPT can seem complex at first glance, but with the right steps, the process is simplified. All you need is:

  1. A token to access the OpenAI API (ChatGPT): You can generate an API key at this link (need to create one OpenAI account).
  2. An app that allows you to connect to the OpenAI API: In this tutorial, we are going to use Jira Misc Workflows Extensions (JMWE) from Appfire.

Creating a token to access the ChatGPT API

The first thing you need to connect with the OpenAI API is an authentication token, and you can do that by following the steps below:

  1. Go to OpenAI's official website: https://openai.com/
  2. Create an account (if you don't already have one).
  3. Then, authenticate with your username on the Platform page, click on your username (upper right corner), and go to the option View API Keys:

openai_view_keys.png      4. This page will display all the keys associated with your account. In this step, click on “Create new secret key” to create a new API key.

ℹ️ Note: It is worth noting that using the ChatGPT API has associated costs. When creating an API key, you will likely be taken to a payment page to enter your credit card information. OpenAI offers a $5 bonus for new users to try out the API as an incentive.

 

Configuring Jira Misc Workflow Extensions in JMWE

Jira Misc Workflow Extensions is an essential app that enriches Jira's workflows. It features customizable conditions, validations and post-functions, as well as the ability to create your own scripts. This versatility allows administrators to tailor workflows to specific needs, making Jira more adaptable and efficient.

Jira's integration with OpenAI (ChatGPT) was done by JMWE through the architecture below:

 

jira_openai_architecture.png

Below you can see a step-by-step on how to perform the integration described above:

Step 1: Create an Entity Property to store the ChatGPT response

You can do this by following the steps below:

  1. Create a post function of type “Set Entity Property value”.
  2. Then, fill in the “Property Name” field with the value “triage_info” (or any other name you prefer).
  3. In the “Value” field, insert this script that is in my GitHub repository.
  4. Scroll down to the “Options” section, check the parameter “Treat value as JSON
  5. Click Save.

When this post-function is ready, and you place it in a transition in your project's Workflow, Jira will generate an Issue Property like the image below whenever the transition is executed:

issue_property.png

 

This Entity Property is a JSON with all the information we need to fill in the Sentiment, Service (Category), and Sentiment Reason fields. 😉

Step 2: Create a post-function to update Jira fields

  1. Create a post function like “Set issue fields (JMWE app)”.
  2. Select the Sentiment field.
  3. In the Value field, enter this script which is in my GitHub repository. Note: Do the same for the fields Service and Reason for Sentiment.

After completing the steps above, and these post-functions are correctly configured in your Jira Workflow transitions, the tickets will be automatically sorted as in the image below:

 

jira_and_chatgpt.gif

The Cost of Automation with ChatGPT

🚀 Good news for managers and executives! Automating ticket triage for Service Desk teams with ChatGPT will only cost you $0.0005515 per ticket! That's right, a fraction of a penny to have the precision and efficiency of artificial intelligence on your side. Imagine the potential savings and efficiency this can bring to your operation!

See the table below for how much the monthly amount would be to automatically sort Jira tickets through ChatGPT:

 

Incredible, isn't it? With a volume of 10,000 tickets/month in your Service Desk, the investment is a mere $5.56 USD to sort them all! An unmissable opportunity to optimize your operation!

 

But how did I arrive at this value? Let's dive into the details.

Tokens: The AI Currency

The ChatGPT API charges based on the number of tokens processed. Tokens can be words, characters and even symbols, varying by language. While we can estimate the number of tokens that text might consume, determining the exact number of tokens used by the ChatGPT API to process and respond to a specific prompt involves complex variables and cannot be predicted with absolute precision.

Understanding Token Calculation:

Calculating tokens in ChatGPT may seem complex at first glance, but we can simplify it for practical purposes. While there are a lot of technicalities behind this calculation, I'll present a simplified approach using just two variables:

  • Number of Words: Refers to the total number of words in a prompt, including the initial question and the answer generated by ChatGPT.
  • Language Factor: Each language has a different structure and verbosity, which can influence the number of tokens. For example, texts in English tend to be more concise.

The simplified formula for estimating the amount of tokens is:

Estimated Number of Tokens = [Number of Words] * [Language Factor]

The following table illustrates an estimate of tokens for a text of 100 words in three different languages: English, French and Portuguese. Using the formula above, we can get a rough idea of how many tokens are needed for each language:

ℹ️ Note: Keep in mind that this is a simplified approach and the actual number of tokens may vary based on many factors, including the complexity of the text and the response generated.

And how much does each Token cost?

As of the date of publication of this article, the prices charged by OpenAI for processing messages sent to its API are:

  • With GPT-3.5 Turbo model and 4K context: $0.0015 for 1K tokens (input) and $0.002 for 1K tokens (output).
  • With GPT-3.5 Turbo model and 16K context: $0.003 per 1K tokens (input) and $0.004 per 1K tokens (output).

To illustrate: if you send a prompt of 200 tokens and receive a response of 800 tokens with the 4K model, the cost is 1000 tokens. This translates to: (200 tokens * $0.0015) + (800 tokens * $0.002).

Estimates Based on Actual Data

To determine how many tokens the ChatGPT API might need when processing messages, I analyzed several databases in Jira Service Management. The objective was to identify the average number of words per ticket, considering different types of projects. The following table shows the average number of words in both the original ticket (input) and the response generated by ChatGPT:

 

Based on the average number of words per project type, we can calculate the estimated amount of tokens that the ChatGPT API will need to process the messages. The formula for this estimate is:

Tokens (Input) = ([Number of Base Prompt Words] + [Number of Words by Project Type]) * [Language Factor].

ℹ️ Note: "Prompt Base" has a total of 153 words. You can check the full content of this prompt at this link.

Tokens (Response) = [Number of Words in ChatGPT response] * [Language Factor]

 

For example, for a Servide Desk IT project in English, it would be:

  • Tokens (Input) = (153 words + 37 words) x 1.5 =~ 285 tokens.
  • Tokens (Answer) = 41 x 1.5 =~ 62 tokens.

 

Now, with the total number of tokens for input and response, we can calculate the cost using OpenAI pricing for ChatGPT 3.5 Turbo:

  • Entry Price (input) = Entry Tokens / 1000 x $0.0015
  • Response Price (output) = Response Tokens / 1000 x $0.002

 

Total cost

Entry = 285 tokens x $0.0015/1000 = $0.0004275

Answer = 62 tokens x $0.002/1000 = $0.000124

Total = $0.0004275 + $0.000124 = $0.0005515

 

Conclusion:

Based on this estimate, the cost to triage a ticket in an IT Service Desk environment using English is just $0.0005515 per ticket.

I'd like to emphasize that this is an estimate based on data I've collected from the instances I manage and conversations with other Jira admins. Each environment has its own specificities and characteristics. Additionally, OpenAI's pricing policies may change from time to time.

The purpose of this section of this article is to provide an overview on costs. I strongly recommend conducting specific studies in your Jira environment before any implementation to determine the monthly cost. Also, please visit the OpenAI official website for up-to-date pricing information.

 

🔮 The future of ticket triage with AI

Integrating tools like ChatGPT into Jira has already demonstrated the transformative power of artificial intelligence in ticket management. While AI currently assists in sentiment sorting and analysis, the potential for future optimizations is immense. The continuous evolution of technology suggests that soon we will have even more integrated solutions, making support processes more agile and accurate. In a world where efficiency is crucial, combining Jira and AI promises to be a milestone in the customer service revolution.

 

📢 Let's Talk!

I look forward to hearing your experiences! If you've already implemented automation with ChatGPT in your company or have unique insights into your Jira environment, please share them with me in the comments. Your vision can open new horizons and inspire others to follow this innovative path. Tell me your story, and let's exchange ideas and experiences! 🚀👥

Also, I invite you to follow me on LinkedIn for more content like this. Let's dive into Atlassian and Artificial Intelligence solutions together!

1 comment

Rafael Frasson September 24, 2024

Nice bro, i will try.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events