{
  "id": "oMPzIvHGqBMRtDqs",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Bug Issue",
  "tags": [],
  "nodes": [
    {
      "id": "f6c0e6ea-e5f6-4cd2-9c52-74a85d4a998a",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -208,
        0
      ],
      "parameters": {
        "path": "c16e3a34-5998-41c2-8a94-c9f0bddf3f27",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "2a817d54-8ecf-42c6-ab5f-bc987ebdc08a",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        16,
        192
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc29d312-a00b-485d-803e-f8af7fa0f920",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        592,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fee097c0-d7c0-454e-b935-32d2ca3b8eff",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "14d12835-4bbe-4b62-830b-54d9943b69e7",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        992,
        144
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2017650b-61f7-4d8d-9366-047dc68b8c97",
      "name": "Create an issue",
      "type": "n8n-nodes-base.github",
      "position": [
        1360,
        -16
      ],
      "parameters": {
        "body": "=Summary:\n{{ $json.output.text }}\n\nDescription:\n{{ $('Filter').item.json.message }}\n\nImage: ![Image]({{ $('Bug Classifier').item.json.body.imageUrl }})\n",
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "https://github.com/rully-saputra15"
        },
        "title": "=New issue from {{ $('Filter').item.json.body.name }} - {{ $('Filter').item.json.body.userId }}",
        "labels": [],
        "assignees": [],
        "repository": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "76527e66-3b6c-4d09-a494-c7393992bf3f",
      "name": "Approval from Manager",
      "type": "n8n-nodes-base.gmail",
      "position": [
        384,
        176
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Review: {{ $json.body.message }}\n\nBy: {{ $json.body.name }}\nUser Id: {{ $json.body.userId }}",
        "options": {},
        "subject": "=Approval to create a issue bug by {{ $json.body.name }}",
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double"
          }
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "58b044b1-12ff-4128-9d51-0525cf2eec89",
      "name": "Filter",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        -16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "618eaa69-fe2e-45b0-b2c0-0ceeda914576",
              "name": "message",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.message }}"
            },
            {
              "id": "65078ccf-1874-44fe-949e-3233e0c14eb6",
              "name": "body.name",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.name }}"
            },
            {
              "id": "b835283c-9624-48ac-b393-43fb934ac143",
              "name": "body.userId",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.userId }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6e262f05-116d-45cd-9092-7fdea722b434",
      "name": "Notify Group",
      "type": "n8n-nodes-base.telegram",
      "position": [
        816,
        352
      ],
      "parameters": {
        "text": "=Severity: Low\n\nIssue: {{ $('Bug Classifier').item.json.body.message }}\n\nName: {{ $('Bug Classifier').item.json.body.name }}\n\nUser ID: {{ $('Bug Classifier').item.json.body.userId }}",
        "chatId": "",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b55c9000-7bb6-45e9-923c-a2c804b777c5",
      "name": "Notify Manager Group",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1536,
        -16
      ],
      "parameters": {
        "text": "=\u2757\u2757\u2757Severity: High\u2757\u2757\u2757\n\nSummary: {{ $('Bug Description Summarizer').item.json.output.text }}\n\nIssue: {{ $('Bug Classifier').item.json.body.message }}\n\nName: {{ $('Bug Classifier').item.json.body.name }}\n\nUser ID: {{ $('Bug Classifier').item.json.body.userId }}\n\nGithub Link: {{ $json.html_url }}",
        "chatId": "",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "40efd4b5-ec3c-41fd-b484-822093fa081e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -352
      ],
      "parameters": {
        "width": 752,
        "height": 304,
        "content": "## Auto-Create GitHub Issues from Webhook Events & Notify via Telegram \ud83d\ude80\nAutomate bug or task creation using a smart classifier and summarizer powered by Gemini. This setups listens forincoming data, automatically classifies it, and sends a real-time notification to Telegram group.\n\nTo make it more robust, consider adding manager approval for the low-severity issues, in case only high-severity issues are meant to be included in Github Repo.\n\nThis solution is perfect for teams that receive bug reports or logs from external soruces and need immediate visibility.\n\nYou can replace Telegram with your preferred messaging platform."
      },
      "typeVersion": 1
    },
    {
      "id": "3966e550-09a1-430c-8e11-7f0300cf7552",
      "name": "Bug Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        16,
        0
      ],
      "parameters": {
        "options": {
          "systemPromptTemplate": "Please classify the text provided by the user that report bug from our platform into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json."
        },
        "inputText": "={{ $('Webhook').item.json.body.message }}",
        "categories": {
          "categories": [
            {
              "category": "High",
              "description": "A bug that disrupt the main user flow."
            },
            {
              "category": "Low",
              "description": "A bug that didn't impact the user flow but could reduce the user experience."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "2a02b306-9926-4d86-be92-06d5bba9dfe3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        -224
      ],
      "parameters": {
        "color": 7,
        "content": "## Filter\nEnsure that only the relevant value is passed to the bug description summarizer."
      },
      "typeVersion": 1
    },
    {
      "id": "17a9943c-2bd5-4dc5-8789-2d951eee606d",
      "name": "Bug Description Summarizer",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        992,
        -16
      ],
      "parameters": {
        "options": {},
        "chunkSize": 100000
      },
      "typeVersion": 2.1
    },
    {
      "id": "dbdb329d-de7f-4e85-97d6-d2db98f7e48d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        176
      ],
      "parameters": {
        "color": 7,
        "content": "## Github\nYou can change with your repo link."
      },
      "typeVersion": 1
    },
    {
      "id": "37083a4e-9a3d-452c-9415-3563b075841c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 224,
        "content": "## Messaging Platform\nYou can use seperate approaches for Telegram messages based on low or high severity.\n\nTelegram tutorial: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.telegram/message-operations/#send-message"
      },
      "typeVersion": 1
    },
    {
      "id": "9a8eaa1a-df98-44c6-a0ef-8ed5abe73d43",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 208,
        "height": 96,
        "content": "Define the conditions for \u201cHigh\u201d vs \u201cLow\u201d severity based on your data."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "78491155-5d99-456e-afd8-f3c5bb9689ab",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Bug Description Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Bug Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bug Classifier": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Approval from Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an issue": {
      "main": [
        [
          {
            "node": "Notify Manager Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approval from Manager": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Bug Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Bug Description Summarizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Bug Description Summarizer": {
      "main": [
        [
          {
            "node": "Create an issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}