Chat to Ticket

    Shared 4/24/2026

    1 views

    Visual Workflow

    JSON Code

    {
      "id": "y31jE407F3htPHkE",
      "meta": {
        "instanceId": "1dce770c72f48940eec6a12f81ebb2f379cb4d5c6862423bbb5aca1495ccfc94",
        "templateCredsSetupCompleted": true
      },
      "name": "Chat to Ticket",
      "tags": [],
      "nodes": [
        {
          "id": "4be75c09-02cb-4ac7-b0bb-940c22445153",
          "name": "When chat message received",
          "type": "@n8n/n8n-nodes-langchain.chatTrigger",
          "position": [
            -304,
            -112
          ],
          "webhookId": "96fd99b7-4e5e-46ca-8d46-4ff276dfc2bf",
          "parameters": {
            "public": true,
            "options": {
              "responseMode": "responseNodes"
            },
            "authentication": "n8nUserAuth"
          },
          "typeVersion": 1.4,
          "alwaysOutputData": false
        },
        {
          "id": "1e92e6ac-e309-4ef3-8d07-6c7db34463e4",
          "name": "Basic LLM Chain",
          "type": "@n8n/n8n-nodes-langchain.chainLlm",
          "position": [
            -80,
            -112
          ],
          "parameters": {
            "batching": {},
            "messages": {
              "messageValues": [
                {
                  "message": "=You are a JIRA ticket creation assistant. Interpret a developer's freeform message and produce exactly one JIRA ticket as a raw JSON object.\n\n## Output Rules\n- Respond with ONLY a valid JSON object. No markdown, no backticks, no code fences, no explanation.\n- Do not wrap output in ```json or any other formatting.\n- The response must be parseable by JSON.parse() with no preprocessing.\n\n## Ticket Types\nChoose exactly one based on message intent:\n- Bug – Something is broken or behaving incorrectly (wrong output, crash, data corruption)\n- Spike – An investigation or research task where the outcome is understanding, not necessarily a code change\n- Feature Request – A new capability or enhancement that doesn't currently exist\n- Work Item – A concrete implementation task, refactor, or improvement that doesn't fit the above\n\n## JSON Schema\n{\n  \"type\": \"<Bug | Spike | Feature Request | Work Item>\",\n  \"summary\": \"<imperative one-liner, max 10 words, no trailing period>\",\n  \"objective\": \"<3–4 sentences: explain the problem or goal, why it matters, and any known context or symptoms>\",\n  \"scope\": [\"<full sentence describing a specific in-scope item>\", \"...\"],\n  \"out_of_scope\": [\"<full sentence describing an explicitly excluded area>\", \"...\"],\n  \"acceptance_criteria\": [\"<verifiable outcome starting with a verb>\", \"...\"]\n}\n\n## Field Rules\n- type: infer from intent, not keywords alone\n- summary: actionable and specific — avoid vague titles like \"Fix issue\" or \"Look into problem\"\n- objective: plain English, written for a developer with no prior context\n- scope: minimum 3 items; reference file names, classes, line numbers, APIs, or services if mentioned; each item must be a full sentence\n- out_of_scope: leave as empty array [] if nothing is clearly excluded\n- acceptance_criteria: minimum 3 items; each must be a verifiable outcome starting with a verb (e.g. \"Identify...\", \"Document...\", \"Confirm...\")\n\n## Inference Rules\n- If a file, class, or line number is mentioned, include it in scope\n- If the message is ambiguous, lean toward Spike rather than Work Item\n- Always produce exactly one ticket\n- Never reference the original input message in your output"
                }
              ]
            }
          },
          "typeVersion": 1.9
        },
        {
          "id": "ac479100-b797-4295-be75-f6ef67fa62a1",
          "name": "Edit Fields",
          "type": "n8n-nodes-base.set",
          "position": [
            944,
            -208
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "09d8e4e0-bfc7-4430-9747-b1d597829869",
                  "name": "type",
                  "type": "string",
                  "value": "={{\n  ({\n    \"Work Item\": 10106,\n    \"Bug\": 10102,\n    \"Spike\": 10112,\n    \"Feature Request\": 11402,\n  }[$json.type] ?? 10106)\n}}"
                }
              ]
            },
            "includeOtherFields": true
          },
          "typeVersion": 3.4
        },
        {
          "id": "37fde806-d0a9-4f74-8689-2f1e0b34bbc6",
          "name": "Create an issue",
          "type": "n8n-nodes-base.jira",
          "position": [
            1136,
            -112
          ],
          "parameters": {
            "project": {
              "__rl": true,
              "mode": "list",
              "value": "15753",
              "cachedResultName": "protel Air"
            },
            "summary": "={{ $json.summary }}",
            "issueType": {
              "__rl": true,
              "mode": "id",
              "value": "={{ $json.type }}"
            },
            "jiraVersion": "serverPat",
            "additionalFields": {
              "description": "={{\n  (function () {\n    const i = $json;\n\n    const text = (v) =>\n      (v ?? '').toString().trim() || '_None_';\n\n    const bullets = (arr) => {\n      const items = (arr ?? []).filter(Boolean);\n      return items.length\n        ? items.map(v => `* ${v}`).join('\\n')\n        : '_None_';\n    };\n\n    return [\n      `h2. Objective`,\n      text(i.objective),\n      ``,\n      `h2. Scope`,\n      bullets(i.scope),\n      ``,\n      `h2. Out of Scope`,\n      bullets(i.out_of_scope),\n      ``,\n      `h2. Acceptance Criteria`,\n      bullets(i.acceptance_criteria),\n      ``,\n      `----`,\n      `*Generated by n8n*`\n    ].join('\\n');\n  })()\n}}"
            }
          },
          "credentials": {
            "jiraSoftwareServerPatApi": {
              "id": "xUvqZNoWCniXuY58",
              "name": "Jira SW Cloud account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "6e54e2c8-468f-46e2-91c8-2dbfa0246ec2",
          "name": "Chat Approval",
          "type": "@n8n/n8n-nodes-langchain.chat",
          "position": [
            496,
            -112
          ],
          "webhookId": "124eb41a-cadd-44ce-ae0f-ed15a552ca77",
          "parameters": {
            "message": "={{\n  [\n    \"🚨 APPROVAL REQUIRED – JIRA ticket creation\",\n    \"\",\n    \"You must explicitly approve or decline before anything is created.\",\n    \"\",\n    \"─────────────────────────\",\n    \"\",\n    \"🏷️ **TYPE**\",\n    \"\",\n    $json.type ?? \"(not set)\",\n    \"\",\n    \"📝 SUMMARY\",\n    \"\",\n    $json.summary,\n    \"\",\n    \"🎯 OBJECTIVE\",\n    \"\",\n    $json.objective,\n    \"\",\n    \"📌 SCOPE\",\n    \"\",\n    ...($json.scope ?? []).map(s => `- ${s}`),\n    \"\",\n    \"✅ ACCEPTANCE CRITERIA\",\n    \"\",\n    ...($json.acceptance_criteria ?? []).map(a => `- ${a}`),\n    \"\",\n    \"─────────────────────────\",\n    \"\",\n    \"👉 PLEASE DECIDE:\",\n    \"\",\n    \"- Approve → JIRA ticket will be created\",\n    \"- Decline → Workflow stops, nothing is created\"\n  ].join(\"\\n\")\n}}",
            "options": {
              "limitWaitTime": {
                "values": {
                  "resumeUnit": "minutes",
                  "resumeAmount": 10
                }
              }
            },
            "operation": "sendAndWait",
            "responseType": "approval",
            "approvalOptions": {
              "values": {
                "approvalType": "double"
              }
            }
          },
          "typeVersion": 1.2,
          "alwaysOutputData": false
        },
        {
          "id": "27802646-704c-4122-952d-8ac6f5d9aa1e",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            720,
            -112
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 3,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "adffd9fc-5a4e-4b1b-885a-1fadf96ce800",
                  "operator": {
                    "type": "boolean",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.data.approved }}",
                  "rightValue": true
                }
              ]
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "82176819-b33c-4e7f-ac7c-7017b26cc0ec",
          "name": "Bye Message",
          "type": "@n8n/n8n-nodes-langchain.chat",
          "position": [
            944,
            -16
          ],
          "webhookId": "ad8dcfe8-2d5e-4dc1-9f1c-4e1d32fde319",
          "parameters": {
            "message": "Maybe next time ;)",
            "options": {}
          },
          "typeVersion": 1.2
        },
        {
          "id": "4c6a587b-4bbe-4ff2-8797-0631221f00ef",
          "name": "Send back ticket number",
          "type": "@n8n/n8n-nodes-langchain.chat",
          "position": [
            1552,
            -208
          ],
          "webhookId": "04954bb5-4e72-4232-b79c-371d9ae6f907",
          "parameters": {
            "message": "={{ $json.id\n? `✅ Jira ticket created successfully!\\n\\nhttps://jira.weareplanet.com/browse/${$json.key}` \n  : '❌ Jira ticket creation failed. No ticket ID was returned.'\n}}",
            "options": {}
          },
          "typeVersion": 1.2
        },
        {
          "id": "2fb57796-9e1d-4842-826f-b267906a4577",
          "name": "Parse JSON",
          "type": "n8n-nodes-base.code",
          "position": [
            272,
            -112
          ],
          "parameters": {
            "jsCode": "const raw = $input.first().json.text.replace(/```json|```/g, '').trim();\nreturn [{ json: JSON.parse(raw) }];"
          },
          "typeVersion": 2
        },
        {
          "id": "db8785a2-316b-4b65-98ce-1465be392ff6",
          "name": "AWS Bedrock Chat Model",
          "type": "@n8n/n8n-nodes-langchain.lmChatAwsBedrock",
          "position": [
            -80,
            112
          ],
          "parameters": {
            "model": "=global.amazon.nova-2-lite-v1:0",
            "options": {},
            "modelSource": "inferenceProfile"
          },
          "credentials": {
            "aws": {
              "id": "tMCG62vdsWxBq627",
              "name": "AWS (IAM) account 6"
            }
          },
          "typeVersion": 1.1
        },
        {
          "id": "e9a543c0-a5d5-46b9-93b2-8fcae8631ee7",
          "name": "Edit Fields1",
          "type": "n8n-nodes-base.set",
          "position": [
            1360,
            -208
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "69a2f86d-2605-4799-beed-35bb0ed82664",
                  "name": "id",
                  "type": "string",
                  "value": "={{ $('Create an issue').item.json.id }}"
                },
                {
                  "id": "fdc3efdb-0dc7-4611-ab86-49bd500e35ab",
                  "name": "key",
                  "type": "string",
                  "value": "={{ $json.key }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        }
      ],
      "active": true,
      "pinData": {
        "Edit Fields1": [
          {
            "json": {
              "id": "1190174",
              "key": "PAIR-18953"
            },
            "pairedItem": {
              "item": 0
            }
          }
        ],
        "Create an issue": [
          {
            "json": {
              "id": "1190174",
              "key": "PAIR-18953",
              "self": "https://jira.weareplanet.com/rest/api/2/issue/1190174"
            }
          }
        ]
      },
      "settings": {
        "binaryMode": "separate",
        "availableInMCP": false,
        "executionOrder": "v1"
      },
      "versionId": "f5d9b7ae-cbbc-4f7f-88fd-45fab08808c1",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Edit Fields",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Bye Message",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Parse JSON": {
          "main": [
            [
              {
                "node": "Chat Approval",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Edit Fields": {
          "main": [
            [
              {
                "node": "Edit Fields1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Edit Fields1": {
          "main": [
            [
              {
                "node": "Send back ticket number",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Chat Approval": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Basic LLM Chain": {
          "main": [
            [
              {
                "node": "Parse JSON",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Create an issue": {
          "main": [
            []
          ]
        },
        "AWS Bedrock Chat Model": {
          "ai_languageModel": [
            [
              {
                "node": "Basic LLM Chain",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Send back ticket number": {
          "main": [
            []
          ]
        },
        "When chat message received": {
          "main": [
            [
              {
                "node": "Basic LLM Chain",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }