{
  "nodes": [
    {
      "id": "50464290-3352-49d8-a055-af7d43754ef7",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        832,
        560
      ],
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "enter-your-chat-id",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0a0a55fe-d075-482a-baca-cd64cc8c207e",
      "name": "JotForm Trigger",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -240,
        560
      ],
      "parameters": {
        "form": "252865896233066",
        "onlyAnswers": false
      },
      "credentials": {
        "jotFormApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "66f6ed0c-2263-4e75-8265-c8ee563e2205",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        16,
        560
      ],
      "parameters": {
        "text": "=1. Firstly read the user submitted bug description from the below content:\n\n{{ $json.rawRequest['Bug Description'] }}\n\n2. Then secondly check whether the bug is already created in github repo or not for that use the tool named \"Get issues of a repository in GitHub\" and just check whethere the bug is already listed or not based on the context.\n\n3. If that particular issue is not there in github repo then simply create a new issue with appropiate names and for that just use the tool named \"Create an issue in GitHub\".\n\n4. And then only after following these above 3 steps above and then give output only in JSON with appropiate details:\n\nexample output:\n{\n  \"issue_name\": \"UI Freeze on Back Navigation from Settings to Home\",\n  \"issue_description\": \"A critical navigation bug occurs when a user attempts to return to the Home screen from the Settings screen. Upon initiating the back navigation action, the application's view transitions to the Home screen, but the user interface becomes completely unresponsive. All interactive elements fail to register any input, effectively trapping the user on a frozen Home screen and necessitating a full application restart to restore functionality.\",\n  \"present_in_github\": false\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "663dd67a-bfff-4d6b-8792-c285a65f4747",
      "name": "Get issues of a repository in GitHub",
      "type": "n8n-nodes-base.githubTool",
      "position": [
        0,
        816
      ],
      "parameters": {
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "="
        },
        "resource": "repository",
        "repository": {
          "__rl": true,
          "mode": "url",
          "value": "="
        },
        "getRepositoryIssuesFilters": {}
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "de299064-b480-4b29-9f33-68a002531bad",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -176,
        832
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e2d56ba4-fd1b-4510-95da-20e2535fb766",
      "name": "Create an issue in GitHub",
      "type": "n8n-nodes-base.githubTool",
      "position": [
        176,
        816
      ],
      "parameters": {
        "body": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Body', ``, 'string') }}",
        "owner": {
          "__rl": true,
          "mode": "url",
          "value": "="
        },
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "labels": [],
        "assignees": [],
        "repository": {
          "__rl": true,
          "mode": "url",
          "value": "="
        }
      },
      "credentials": {
        "githubApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "bf1272a6-7ba4-4939-b984-4d328420eb94",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        336,
        832
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"issue_name\": \"UI Freeze on Back Navigation from Settings to Home\",\n  \"issue_description\": \"A critical navigation bug occurs when a user attempts to return to the Home screen from the Settings screen. Upon initiating the back navigation action, the application's view transitions to the Home screen, but the user interface becomes completely unresponsive. All interactive elements fail to register any input, effectively trapping the user on a frozen Home screen and necessitating a full application restart to restore functionality.\",\n  \"present_in_github\": false\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "3b1f6ac3-c695-48cf-aef9-90f00224bec4",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        400,
        560
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $('JotForm Trigger').item.json.submissionID }}",
            "email": "={{ $('JotForm Trigger').item.json.rawRequest['Your Email Address'] }}",
            "issue": "={{ $json.output.issue_description }}",
            "Full name": "={{ $('JotForm Trigger').item.json.rawRequest['Your Name'].first }} {{ $('JotForm Trigger').item.json.rawRequest['Your Name'].last }}",
            "present_in_github?": "={{ $json.output.present_in_github }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "Full name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Full name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "issue",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "issue",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "present_in_github?",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "present_in_github?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhQv-pyvnN4-j2hvH7DgYXSS3BZKrCLZlzV2a3eVJAw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WhQv-pyvnN4-j2hvH7DgYXSS3BZKrCLZlzV2a3eVJAw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhQv-pyvnN4-j2hvH7DgYXSS3BZKrCLZlzV2a3eVJAw/edit?usp=drivesdk",
          "cachedResultName": "Github user submitted BUGS log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "6f5df4f5-563c-4d8b-ae1f-fede2b464754",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        560
      ],
      "parameters": {
        "jsCode": "const item = items[0];\n\nconst issueDetails = item.json.issue;\nconst isPresentOnGithub = item.json['present_in_github?'];\n\nlet message = `An user submitted an issue....\\n\\n**Issue:** \"${issueDetails}\"\\n\\n`;\n\nif (isPresentOnGithub) {\n  message += \"\u2705 You don't need to do anything regarding this, as the issue is already reported on GitHub.\";\n} else {\n  message += \"\u2757 Please look into this. The issue has just been created in our GitHub repo, so take your time to review and fix it.\";\n}\n\nitem.json.message = message;\n\nreturn item;"
      },
      "typeVersion": 2
    },
    {
      "id": "aaafdc7e-0b25-471b-8ae5-eaca969d9994",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        224
      ],
      "parameters": {
        "width": 1360,
        "height": 768,
        "content": "This workflow automates the process of handling bug reports submitted through a form, from checking for duplicates on GitHub to logging the report and sending a notification.\n\n---\nA bug report is submitted via a JotForm, initiating the workflow.\n\nAn AI agent checks for duplicates on GitHub, creating a new issue if the bug is unique.\n\nThe form submission and the AI's analysis are logged in a Google Sheet for record-keeping.\n\nA dynamic notification is sent to a Telegram chat, alerting the team to the new or existing issue."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JotForm Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Create an issue in GitHub": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get issues of a repository in GitHub": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}