AutomationFlowsAI & RAG › Ai-powered Auto-tagging for Zendesk Tickets Using Gpt-4.1-mini

Ai-powered Auto-tagging for Zendesk Tickets Using Gpt-4.1-mini

ByErtay Kaya @ertay on n8n.io

This workflow automatically reviews new Zendesk tickets and tags them using OpenAI’s language model. It runs every 24 hours, fetches tickets created in the last day (for specified brands), and uses an AI agent to analyze each ticket’s content. Based on customizable rules, the…

Cron / scheduled trigger★★★★☆ complexityAI-powered13 nodesZendesk ToolOpenAI ChatZendeskAgent
AI & RAG Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #11167 — we link there as the canonical source.

This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "957d1668-a270-40cc-9593-94630201fdc9",
      "name": "Update a ticket in Zendesk",
      "type": "n8n-nodes-base.zendeskTool",
      "position": [
        960,
        240
      ],
      "parameters": {
        "id": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Ticket_ID', `This is the field that you need to set to the id of the ticket.`, 'string') }}",
        "operation": "update",
        "updateFields": {
          "tags": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tag_Names_or_IDs', `You should set this value to the tag to tag the ticket with.`, 'string') }}"
        },
        "descriptionType": "manual",
        "toolDescription": "Use this tool to tag Zendesk tickets with tags which they need to be tagged with. This tool allows you to tag a ticket with a single tag or with multiple tags as an array."
      },
      "credentials": {
        "zendeskApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7a94b9ee-466b-4eea-a22e-03d63ad3d8e9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        240
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ecb5d73c-cb33-49a5-94ae-a50d291cd2f1",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -144,
        32
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 10
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "acf3bc44-582d-4dd7-b579-34ee43199e01",
      "name": "Set Zendesk brands",
      "type": "n8n-nodes-base.set",
      "position": [
        96,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "30e3fdcc-8fd1-412c-ac95-d1a08ef4c9c0",
              "name": "brands",
              "type": "string",
              "value": "brand:brand_id1 brand:brand_id2 brand:brand_id3"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "198922b4-5530-4992-9c8f-c5849bd46601",
      "name": "Get tickets",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        336,
        32
      ],
      "parameters": {
        "options": {
          "query": "=created>{{$now.minus({hours: 24})}} {{ $json.brands }}",
          "sortBy": "created_at",
          "sortOrder": "desc"
        },
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "zendeskApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "3ac5ac9f-45ec-4c54-95e4-b3adb1ec0957",
      "name": "Prepare tickets for the agent",
      "type": "n8n-nodes-base.set",
      "position": [
        544,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b692442a-e363-48fa-a4a9-d78cf43b5c66",
              "name": "id",
              "type": "number",
              "value": "={{$json.id}}"
            },
            {
              "id": "70d77c54-9877-433f-a312-29ac8bba194d",
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            },
            {
              "id": "a655d2bd-a629-49e8-bd0c-8c8ed9da96aa",
              "name": "description",
              "type": "string",
              "value": "={{ $json.description }}"
            },
            {
              "id": "2c52c3b5-581d-4bc4-a37e-32539073bb13",
              "name": "brand",
              "type": "string",
              "value": "={{ \n{ \n    brand_id1: \"brand_name1\",\n    brand_id2: \"brand_name2\",\n    brand_id3: \"brand_name3\",\n    brand_id4: \"brand_name4\"\n}[$json.brand_id] || \"\" \n}}"
            },
            {
              "id": "928e55bf-492b-449c-bc03-f1a269b77d5d",
              "name": "existing_tags",
              "type": "array",
              "value": "={{ $json.tags }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0025f526-ea7f-4d47-9d72-f8b30453fbe0",
      "name": "AI Agent - Tag tickets",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        768,
        32
      ],
      "parameters": {
        "text": "=Analyse each ticket and set a tag according to the rules below:\n\n1. Tag to tag the ticket with: tag_name1 | Condition: condition1\n2. Tag to tag the ticket with: tag_name2 | Condition: condition2\n3. Tag to tag the ticket with: tag_name3 | Condition: condition3\n\nIf a ticket meets more than one of the conditions above, tag the ticket with the tags of all of those conditions.\n\nIf the ticket already has any existing tags, make sure you tag the ticket again with those existing tags as well as the new ones. \n\nWhen tagging a ticket you need to use the id of the ticket and the tag itself.  \n\nThese are the tickets:\n{{$json.toJsonString()}}\n",
        "options": {
          "systemMessage": "You are an agent whose job is to review Zendesk tickets created by the users of an application. Users create Zendesk tickets when they have a complaint or when they want to share some feedback. Your job is to review the content of the ticket and tag tickets with relevant tags using the Zendesk ticket update tool available to you. \n\nEach ticket contains the following fields:\n1. id: Numerical id of the ticket.\n2. subject: subject of the ticket as set by the user\n3. description: description of the ticket  as set by the user\n4. brand: brand of the application\n5. existing_tags: the tags which the ticket is currently tagged with "
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "e31997e1-0fc8-43c5-b2b0-ffe421d03de6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -96
      ],
      "parameters": {
        "width": 208,
        "height": 288,
        "content": "Define the brand ids of the brands which you want the agent to tag their tickets"
      },
      "typeVersion": 1
    },
    {
      "id": "564761b7-1d84-4b02-ab31-a467443cc4e0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -96
      ],
      "parameters": {
        "width": 192,
        "height": 288,
        "content": "Fetch tickets created in the last 24 hours"
      },
      "typeVersion": 1
    },
    {
      "id": "d97011c5-f6c3-482a-901e-7312e9aef482",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -176,
        -96
      ],
      "parameters": {
        "width": 176,
        "height": 288,
        "content": "Runs once every 24 hours"
      },
      "typeVersion": 1
    },
    {
      "id": "13c660ea-c850-494b-bf92-88edcaaf9da7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -96
      ],
      "parameters": {
        "width": 224,
        "height": 288,
        "content": "Get rid of the ticket fields the agent does not need. Replace brand_idX and brand_nameX with the actual brand ids and names"
      },
      "typeVersion": 1
    },
    {
      "id": "653ccfae-7218-47dc-97c4-712c9fd711ed",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -96
      ],
      "parameters": {
        "width": 288,
        "height": 288,
        "content": "Replace \"tag_nameX\" and \"conditionX\" with your tags and conditions for the agent to tag the ticket with that tag (For example: \"if the ticket description contains words X, Y Z\")"
      },
      "typeVersion": 1
    },
    {
      "id": "8cd2c634-144c-40c0-b755-97e378b8f66e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -112
      ],
      "parameters": {
        "width": 432,
        "height": 592,
        "content": "## Auto-tag Zendesk Tickets using Zendesk API and OpenAI\n\nThis workflow automatically reviews new Zendesk tickets and tags them using OpenAI\u2019s language model. It runs every 24 hours, fetches tickets created in the last day (for specified brands), and uses an AI agent to analyze each ticket\u2019s content. Based on customizable rules, the agent suggests and applies relevant tags, ensuring existing tags are preserved. This helps automate ticket categorization and improves support team efficiency.\n\n**Key Features:**\n\n* Scheduled daily execution\n* Brand filtering for targeted ticket processing\n* AI-powered tagging based on ticket content and custom rules\n* Preserves existing tags while adding new ones\n\n\n**Setup Instructions:**\n\n* Replace placeholder brand IDs/names and tag rules with your own.\n* Connect your Zendesk and OpenAI accounts.\n* Adjust the schedule or ticket query as needed."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Get tickets": {
      "main": [
        [
          {
            "node": "Prepare tickets for the agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Zendesk brands",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Tag tickets",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Zendesk brands": {
      "main": [
        [
          {
            "node": "Get tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update a ticket in Zendesk": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - Tag tickets",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Prepare tickets for the agent": {
      "main": [
        [
          {
            "node": "AI Agent - Tag tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow automatically reviews new Zendesk tickets and tags them using OpenAI’s language model. It runs every 24 hours, fetches tickets created in the last day (for specified brands), and uses an AI agent to analyze each ticket’s content. Based on customizable rules, the…

Source: https://n8n.io/workflows/11167/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow is built for B2B SaaS and CX teams that are drowning in unstructured customer feedback across tools. It’s ideal for Customer Success, Product and Support leaders who want a light “voice

Gmail Tool, Memory Buffer Window, Pipedrive Tool +7
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Mailgun, OpenAI, OpenAI Chat +8
AI & RAG

⚠️ DISCLAIMER: This workflow uses the AnySite LinkedIn community node, which is only available on self-hosted n8n instances. It will not work on n8n.cloud.

OpenAI Chat, Output Parser Structured, Google Sheets +6
AI & RAG

Complete PostgreSQL-backed system: Keyword scoring → AI research → Multi-part content generation → fal.ai Nano Banana image generation → WordPress publishing

WordPress, OpenAI, Perplexity +8
AI & RAG

We’ve released Version 4 of our AI Powered Blog Automation workflow. We heard your complains and made a complete redesign built for serious content creators.

RSS Feed Read, OpenAI Chat, Text Classifier +6