{
  "name": "Conviro AI Failure to Jira Ticket",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "conviro-ai-fail",
        "responseMode": "onReceived"
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"event\"]}}",
              "value2": "ai.failed"
            }
          ]
        }
      },
      "name": "Filter AI Failed",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "resource": "issue",
        "operation": "create",
        "project": "YOUR_PROJECT_KEY",
        "issueType": "Bug",
        "summary": "={{\"[Conviro] AI failure in session \" + $json[\"data\"][\"sessionId\"]}}",
        "additionalFields": {
          "description": "={{\"AI response generation failed.\\n\\nSession ID: \" + $json[\"data\"][\"sessionId\"] + \"\\nError: \" + ($json[\"data\"][\"error\"] || \"Unknown\") + \"\\nTimestamp: \" + $json[\"timestamp\"] + \"\\n\\nPlease investigate and ensure the chatbot is functioning correctly.\"}}",
          "priority": "High",
          "labels": [
            "conviro",
            "ai-failure",
            "auto-created"
          ]
        }
      },
      "name": "Create Jira Issue",
      "type": "n8n-nodes-base.jira",
      "typeVersion": 1,
      "position": [
        700,
        250
      ],
      "credentials": {
        "jiraSoftwareCloudApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Filter AI Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter AI Failed": {
      "main": [
        [
          {
            "node": "Create Jira Issue",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}