Automated customer support tickets with n8n, Slack, Linear and AI

Automated customer support tickets with n8n, Slack, Linear and AI

In this article, we’ll walk you through how to build a simple customer support workflow with n8n that delegates much of the manual support ticket creation process to AI. By the end of the article, you’ll learn how to save time and effort using n8n’s powerful Advanced AI nodes to superboost your ChatOps.

Automated customer support tickets with n8n, Slack, Linear and AI


workflowBanner(2323, document.currentScript)

Prerequisites

Channels:history, channels:read, chat:write, groups:history, groups:read, im:history, im:read, mpim:history, mpim:read, reactions:read, reactions:write, search:read, users:read, users:read.email

Step 1. Create a customer channel in Slack

The support system we’re going to build works by having Slack as the main support request interface for the customer. Customers will post messages directly in the channel where support staff can engage directly. Each request will require a ticket for tracking purposes and to escalate to a technical support personnel if required.

A Slack channel for customer support may be preferable to email because urgent requests can be acknowledged quickly but the transfer of information to the issue tracker may be an overhead – the ticket author needs to think of succinct yet descriptive title and description, identify and rephrase any reproducible steps if mentioned by the user etc. With n8n, we can solve this part of the process with AI!

  • Create a new Slack channel or use an existing one and ensure your Slack app is installed and has access to the chosen channel. This will enable n8n to interact with messages for our workflow. For this tutorial, we’ll call ours #n8n-tickets.
Automated customer support tickets with n8n, Slack, Linear and AI
Create a customer channel in Slack

Step 2. Set up a Scheduled Trigger and Slack node to get latest messages

Not all messages in our customer channel (#n8n-tickets) will be tickets so we want to be selective about which ones will be sent to Linear. We do this by using Slack Reactions to identify valid customer requests – specifically, each message which has the 🎫 (ticket) reaction will help flag the messages we need to capture.

  • To monitor the customer channel, set up a scheduled trigger for an interval which works for your team – for our demo, we’ll set it for 5 minute intervals.
  • Next, add a Slack node to the trigger which will perform a message search operation with the following filter “in:#n8n-tickets has::ticket:”. Set sort to newest and limit to 10, though feel free to change depending on the frequency of requests.

Step 3. Filter out messages that already have an issue ticket assigned

We’ll use Linear.app as our issue tracker in this tutorial but this workflow can work with any project management system supported by n8n such as JIRA.

To avoid duplicating tickets, we’ll need a way to track which message has been processed in previous calls. Our method of choice in this tutorial is by writing the Slack message ID in the ticket itself. We can then pull up the latest tickets from our Linear project to find a match and when found, be able to skip the message.

  • Create a Linear node to perform a Get Many operation for the Issue resource and set the limit to 50. This will pull the latest 50 tickets.
  • Next, use the Aggregate node to collect all the descriptions of the ticket – this is where the Slack Message IDs are stored.
  • Finally, use an IF node which tests for the existence of the current Slack Message ID in the current batch of tickets. This test will determine if a new ticket is required.

Step 4. Create a new Issue template automatically using AI

Now the fun part! Given our customer request, we can instruct AI to summarise and paraphrase to generate a succinct title and a description for the issue. Not only that, we can also use AI to generate possible debugging steps or solutions to try if the query is generic or even connect with internal systems to pull relevant documentation in the right scenario. There are a lot of ideas to try but we’ll keep it simple in this tutorial and just have the AI generate a standard issue. Additionally, we will also instruct our AI to determine the urgency of customer requests and assign the appropriate priority label to the issue.

  • Create a Basic LLM Chain Node with the following instruction:
  • Customer Message: “{{ $(‘Get Values’).item.json.message }}”
    You will complete the following 4 tasks:
    1. Generate a title intended for a support ticket based on the user issue only. Be descriptive but use no more than 10 words.
    2. Summarise the user issue only by identifying the key expectations and steps that were taken to reach the conclusion.
    3. Offer at most 3 suggestions to debug or resolve the user issue only. ignore the previous issues for this task.
    4. Identify the urgency of the user issue only and denote the priority as one of “low”, “medium”, “high” or “urgent”. If you cannot determine the urgency of the issue, then assign the “low” priority. Also consider that requests which require action either today or tomorrow should be prioritised as “high”.
  • Ensure the “Require Specific Output Format” is checked
  • Click the “Output Parser” button and attach a “Structured Output Parser” subnode.
  • In the “Structured Output Parser” subnode, add the following schema
  • { “type”: “object”, “properties”: { “title”: { “type”: “string” }, “summary”: { “type”: “string” }, “ideas”: { “type”: “array”, “items”: { “type”: “string” } }, “priority”: { “type”: “string” } } }

Step 5. Create a new issue in Linear

Now we have our issue title, description and priority label generated by AI and our message metadata from Slack, we can combine the two to create an actual ticket in Linear.

  • Add a Linear node which performs a create operation for the issue resource. Ensure the Team name or ID is set to the project you want to capture the ticket.
  • In the Linear node, map the outputs of the LLM Chain node along with those of the Slack node we set up earlier in the workflow, to the respective title, description and priority fields.
Automated customer support tickets with n8n, Slack, Linear and AI
Create a new issue in Linear 1
Automated customer support tickets with n8n, Slack, Linear and AI
Create a new issue in Linear 2

Step 6. Done!

Now that our workflow is complete, we can activate it and it’ll continue monitoring our customer support channel until stopped. Whenever a valid customer request lands in the channel, we will add the 🎫(ticket) reaction to generate our issue in Linear. Let’s try it out!

Wrap Up

In this tutorial, we’ve learnt how to use n8n and AI to remove a certain type of manual overhead of work processes such as creating issue tickets for customers. We’ve also learnt how we can integrate with products such as Slack and Linear to create powerful workflows with very little effort.

Create your own workflows

Build complex automations 10x faster, without fighting APIs