{
  "nodes": [
    {
      "id": "1219f3dd-e1d0-4e4b-bc55-56b5f9d509c8",
      "name": "JotForm Trigger",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -768,
        0
      ],
      "parameters": {
        "form": "252856264643060",
        "resolveData": false
      },
      "typeVersion": 1
    },
    {
      "id": "ce2cad7e-5f0a-4dae-8f03-6f1dc584b227",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -528,
        -128
      ],
      "parameters": {
        "text": "=You are a business owner responding to customer feedback about your service. Write a concise and thoughtful reply based on the feedback provided.\n\nMention the user\u2019s name: It should be the person name  {{ $json.q3_name.first }}\nHere is the feedback: {{ $json.q6_typeA6 }}\n\nIf the feedback is positive:\n1. express appreciation using gmail tool.\n2. No need to create issue in jira\n\nIf it\u2019s negative:\n1. say Thanks for your feedback, we will ask you some questions. \n2. Also create an issue in jira using jira tool\n\nExample:\nUser Name: {{ $json.q3_name.first }}\nFeedback: The app login feature is not working from two days.\n\nReply:\nHi  {{ $json.q3_name.first }}, sorry to hear about the delay. We\u2019re reviewing our process to ensure your future features work properly. Appreciate your patience and feedback. We will ask you some questions to resolve the issue.\n\nOutput, gmail tool threadid and realfeedback",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "74fe875c-b6bd-40ef-81de-3f47f4cf588c",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -96,
        96
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "de88c674-be3e-4ed5-b8c3-b6745547a95b",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        384,
        -128
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "readStatus": "unread"
        },
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "79f72cac-ab48-46d3-9b30-1fe3b51f53f4",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        688,
        96
      ],
      "parameters": {
        "sessionKey": "={{ $('Gmail Trigger').item.json.threadId }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "4c7b7851-c27c-4aae-aea1-f8d0dbea21b3",
      "name": "Reply to a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        864,
        96
      ],
      "parameters": {
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "emailType": "text",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "reply"
      },
      "typeVersion": 2.1
    },
    {
      "id": "366ad755-af22-4322-a49e-fdc3d9edbc0c",
      "name": "AI Agent (Chat)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        560,
        -128
      ],
      "parameters": {
        "text": "=You are a feedback assistant who handles negative feedbacks.\n\nYou need to reply and ask(Using gmail tool) from client specific information about the issue, until they are facing this which device they were using and any reprodcable steps(if no that's fine), Ask them to stay in touch so we can resolve the issue and team will send a free coupon for free credits.\n\nIf information is already provided:\n1. just send a reply saying thank you we will get back to you \n2. simply summarize and add the details into the project issues using Jira tool\n\nHere is the email: {{ $json.text }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "8a553038-1458-42ac-abf0-7ea72f8d1792",
      "name": "Send a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        -256,
        96
      ],
      "parameters": {
        "sendTo": "={{ $('JotForm Trigger').item.json.q4_email }} ",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "Thank you for your Response",
        "emailType": "text"
      },
      "typeVersion": 2.1
    },
    {
      "id": "4120159b-eeb8-422c-8dd3-a788fb59608b",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -176,
        -128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5b0a3503-12e1-4a0b-8ec8-578f3f359626",
              "name": "text",
              "type": "string",
              "value": "={{ $('JotForm Trigger').item.json.q6_typeA6 }}"
            },
            {
              "id": "8dcfb00f-e592-420b-9e93-434c10cb58c9",
              "name": "threadId",
              "type": "string",
              "value": "={{ $json.threadId }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6335b3ff-7663-471d-8031-e300ae10170f",
      "name": "Create an issue in Jira Software",
      "type": "n8n-nodes-base.jiraTool",
      "position": [
        -416,
        96
      ],
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', ``, 'string') }}",
        "issueType": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "additionalFields": {
          "priority": {
            "mode": "list",
            "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Priority', ``, 'string') }}"
          }
        }
      },
      "typeVersion": 1
    },
    {
      "id": "94426429-8f02-4410-b54e-bee2380c2b51",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        64,
        96
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"threadId\": \"dw676wer8wer\",\n    \"output\": \"jotform q6_typeA6 field\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1df409e1-d7dc-495b-9e3c-92dc11648e57",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -208
      ],
      "parameters": {
        "color": 6,
        "width": 256,
        "height": 480,
        "content": "### Get the feedback from users\n**Sign up for Jotform using:** [https://www.jotform.com/?partner=zainurrehman](https://www.jotform.com/?partner=zainurrehman)"
      },
      "typeVersion": 1
    },
    {
      "id": "91c1c8c0-b4c9-472f-8fe6-d2867141c853",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -208
      ],
      "parameters": {
        "color": 6,
        "width": 832,
        "height": 480,
        "content": "### Identify the feedback request if positive or negative. Based on that create a ticket on jira and send an initial response"
      },
      "typeVersion": 1
    },
    {
      "id": "fd3dd2fc-d65a-432f-9424-0181262e31f1",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -208
      ],
      "parameters": {
        "color": 5,
        "width": 736,
        "height": 480,
        "content": "### This agent asks appropriate question from the user through email to get more insights"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent (Chat)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "AI Agent (Chat)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent (Chat)",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "JotForm Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "AI Agent (Chat)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Reply to a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent (Chat)",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create an issue in Jira Software": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}