Classify Linear Bug Tickets Automatically with n8n & OpenAI

Struggling to triage bug tickets in Linear quickly and accurately? This n8n workflow uses OpenAI to auto-classify bugs into the right team, saving hours of manual sorting and improving developer focus.
linearTrigger
openAi
linear
+7
Workflow Identifier: 1838
NODES in Use: Linear Trigger, Filter, Sticky Note, Linear, HTTP Request, Set, If, Slack, Merge, OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Opening Problem Statement

Meet Niklas, a product manager at a fast-growing software company using Linear to track bug tickets. Every day, Niklas and his team get numerous bug reports, each needing to be assigned to the correct engineering team for resolution. But the triage process is slow and prone to errors. Tickets often arrive without clear descriptions or proper labels, making it hard to decide quickly which team should handle each bug. This leads to delayed fixes, frustrated developers, and wasted hours spent on manual classification.

For example, before automation, the team spent an average of 2 hours daily just reading and assigning bugs manually. Occasionally, bugs were misrouted, causing additional delays and duplicated efforts. With growing ticket volume, this problem was set to become a bottleneck that threatened their agile workflow.

What This Automation Does

Let’s break down what this specific n8n workflow accomplishes:

  • It triggers automatically whenever a new or updated bug ticket with certain criteria appears in Linear.
  • Filters out tickets that lack a meaningful description, don’t have a “bug” label, or are not in the triage state, ensuring only relevant bugs are processed.
  • Uses OpenAI GPT-4 to analyze the bug’s title and description, and classify which internal team should handle it based on pre-set team responsibilities.
  • Fetches the list of all teams from Linear to map the AI’s classification to the actual team ID internally.
  • Updates the bug ticket in Linear, assigning it to the identified team to streamline assignment.
  • If the AI cannot confidently classify the bug into a known team, it automatically sends a notification to a specified Slack channel for manual review.

This workflow can save an estimated 10+ hours per week by automating classification tasks, eliminating manual sorting errors, and accelerating the bug resolution lifecycle.

Prerequisites ⚙️

  • n8n account to build and run the automation.
  • Linear account with proper API OAuth2 credentials to access bug tickets and teams.
  • OpenAI API key (GPT-4 model for best classification accuracy).
  • Slack account with an app token set up to send notifications to a selected channel.

Optionally, you can self-host n8n for enhanced control and security. Check out Hostinger’s guide for easy n8n self-hosting options.

Step-by-Step Guide to Build the Workflow

Step 1: Trigger on New or Updated Bug Ticket in Linear

Navigate to n8n and add a Linear Trigger node.

Set it to trigger on issues in your target Linear team and specify “issue” as the resource.

Connect your Linear OAuth2 credentials for API access.

This node listens for any new or updated bug tickets in the specified Linear project, initiating the workflow.

Common mistake: Forgetting to assign correct OAuth2 credentials results in no trigger firing.

Step 2: Filter Tickets that Need Classification

Add a Filter node after the trigger named “Only tickets that need to be classified.”

This node checks three conditions simultaneously:

  • The description does NOT contain the placeholder text “Add a description here”.
  • The ticket is in the “Triage” state (using the specific state ID from Linear).
  • The ticket includes the “bug” label by verifying the label ID.

If a ticket does not meet all these, it is skipped, reducing noise and focusing only on proper bug tickets.

Tip: Adjust label and state IDs to match your Linear setup.

Step 3: Set Up Team Descriptions

Insert a Set node named “Set me up.”

In this node, define your team’s list in this exact format for the AI prompt:

- [Adore][Is responsible for every persona that is not Enterprise. This includes signup journeys, trials, n8n Cloud, the Canvas building experience and more]
- [Payday][Handles the Enterprise persona. Covers SSO, LDAP, environments, queue mode, version control, external storage, etc.]
- [Nodes][Responsible for everything related to specific nodes in n8n]
- [Other][Placeholder for unclassifiable bugs]

Also set your desired Slack channel name here for notifications.

This serves as input data for OpenAI in the next step.

Step 4: Use OpenAI to Classify the Bug Ticket

Add an OpenAI node (part of LangChain nodes) to analyze the bug ticket.

Configure it with your GPT-4 API credentials.

In the messages section, set system and user prompts as follows:

  • System: “I need you to classify a bug ticket and tell me which team should work on it.”
  • System: “All possible teams will be described in the following format: [Teamname][Areas of responsibility].”
  • System: “=The possible teams are: (teams from Set node).”
  • System: “=This is the bug: Title and Description from the Linear Trigger data.”
  • User prompt: “Which team should work on this bug?”
  • System: “Do not respond with anything else than the name of the team from the list.”

This carefully crafted prompt directs the AI to produce accurate team classification based on provided details.

Example: If the bug is about canvas scrolling issues in the app, AI might respond with “Nodes.”

Step 5: Retrieve All Linear Teams

Add an HTTP Request node to fetch all teams in your Linear workspace via GraphQL.

Configure the request:

  • Method: POST
  • URL: https://api.linear.app/graphql
  • Body parameters: GraphQL query to get teams’ id and name
  • Authentication: Use the same Linear OAuth2 credentials

This node returns all teams needed to match the AI response with actual team IDs.

Step 6: Merge AI Results and Teams Data

Use the Merge node to combine the OpenAI classification result and the HTTP response from “Get all linear teams.”

Set merge mode to “Choose Branch,” so you can keep sync on both data streams.

Step 7: Verify AI Classification Result

Add an If node to check if AI returned a valid team name other than “Other.”

If the AI is confident (team name is not “Other”), continue to assign the bug.

If AI returns “Other,” it means no suitable team was found.

Step 8: Set Team ID Based on AI Classification

Use a Set node to find correct team ID by matching the AI output team name with the teams list fetched.

Use the expression:

{{$json.data.teams.nodes.find(team => team.name === $json.message.content).id}}

This converts team name to the corresponding ID needed to update Linear.

Step 9: Update the Bug Ticket’s Team Assignment in Linear

Add a Linear node (not trigger) to update the issue.

Set the operation to “update” and provide the issue ID from the trigger.

Set the “teamId” to the ID resolved in the previous step.

Ensure your Linear API key credential is selected.

Step 10: Notify Slack If AI Fails to Classify

On the “Else” branch from the If node, add a Slack node.

Configure it to send a message to your specified channel like:

The AI was not able to identify a fitting team for a bug: [bug title here]

This alerts your team to manually triage the ticket promptly.

Customizations ✏️

1. Customize Team Responsibilities: Update the “Set me up” node to add or modify team names and job scopes. This improves AI classification accuracy by reflecting your organization structure.

2. Adjust Filtering Rules: Modify the filter node conditions to change when bugs get classified, for example by including other labels or states from Linear.

3. Slack Notification Content: Edit the Slack node to include more details like the bug URL or assigner, helping the triage team act faster.

4. Expand AI Prompt: Enhance the OpenAI node prompt messages to include additional bug context or specific classification rules.

5. Change Slack Channel: Update the channel name in the “Set me up” node to send notifications to a different Slack workspace or channel.

Troubleshooting 🔧

Problem: “No trigger detected when a new bug is created.”
Cause: Linear Trigger node credentials or team ID set incorrectly.
Solution: Verify OAuth2 credentials, ensure the correct team ID is set in the trigger node parameters. Test with a sample bug ticket.

Problem: “AI returns ‘Other’ for every bug.”
Cause: The team descriptions in the “Set me up” node may not match the prompt expectations or are insufficient.
Solution: Refine team descriptions with clear responsibilities and make sure the format is exactly as required. Test prompt with sample tickets.

Problem: “Bug team assignment not updating in Linear.”
Cause: Incorrect data mapping from AI team name to Linear team ID.
Solution: Check expressions in the “Set team ID” node and ensure the HTTP response from “Get all linear teams” is correct. Also check permissions on the API key.

Pre-Production Checklist ✅

  • Make sure all API credentials (Linear OAuth2, OpenAI, Slack) are valid and authorized.
  • Test the trigger by creating a sample bug in Linear with the required labels and description.
  • Verify the AI classification prompt works correctly by running the workflow and checking the output team name.
  • Confirm the Linear issue updates with the new team assignment after workflow execution.
  • Check Slack messages appear on AI classification failures.
  • Backup your workflow and export for version control.

Deployment Guide

Activate the workflow in the n8n editor by clicking “Active.”

Monitor initial runs from the executions list to verify smooth operation.

Set up logging and notifications for failed workflow runs to maintain reliability.

Adjust team lists and filtering rules over time as your processes evolve.

FAQs

Q: Can I use GPT-3 instead of GPT-4 for classification?
A: Yes, but GPT-4 offers better context understanding and accuracy, improving bug triage quality.

Q: Does this workflow consume many API calls?
A: It uses a few API calls per bug (trigger, teams fetch, update, OpenAI call), so budget accordingly.

Q: Is my ticket data secure?
A: Data is transmitted via secure API tokens and encrypted connections. Use self-hosted n8n for extra control.

Conclusion

By following this guide, you have built a unique n8n workflow that automates the classification of bug tickets in Linear using OpenAI. This automation drastically reduces manual triage time from hours to minutes, ensures bugs are assigned correctly from the start, and improves your team’s overall efficiency.

Imagine reclaiming 10+ hours each week previously spent on manual bug sorting, reducing human error, and speeding up developer responses. Next, consider extending this automation to include auto-prioritization or integration with other communication tools like Microsoft Teams.

Start leveraging AI-powered bug triage today and transform your product team’s workflow!

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation in n8n

A complete beginner guide to building an AI-powered SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free