{
  "id": "sykvbdavO6J0yC9W",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Zoho CRM - Help Desk to CRM Intelligence Bridge",
  "tags": [],
  "nodes": [
    {
      "id": "aa5b4e0f-d983-4dcd-8ce6-976fbe954952",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -384,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "accountManagerEmail",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "id-2",
              "name": "upsellThreshold",
              "type": "number",
              "value": 3
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b8312637-e1ff-4292-a4cf-3873f2223985",
      "name": "Get Customer Record",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        112,
        48
      ],
      "parameters": {
        "limit": 1,
        "options": {},
        "resource": "contact",
        "operation": "getAll"
      },
      "credentials": {
        "zohoOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "58e96af5-7ff7-4262-a9d3-b3d3366f07e0",
      "name": "Create Customer Record",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        560,
        -16
      ],
      "parameters": {
        "lastName": "={{ $('Webhook Trigger').item.json.body.CaseOwner }}",
        "resource": "contact",
        "additionalFields": {
          "Email": "={{ $('Webhook Trigger').item.json.body.Email }}"
        }
      },
      "credentials": {
        "zohoOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "954c323f-e6eb-402f-aa48-6163958709e3",
      "name": "Update Customer Record",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        560,
        144
      ],
      "parameters": {
        "resource": "contact",
        "contactId": "={{ $json.id }}",
        "operation": "update",
        "updateFields": {
          "customFields": {
            "customFields": [
              {
                "value": "={{ $now.toISO() }}",
                "fieldId": "Last Ticket Date Field ID"
              }
            ]
          }
        }
      },
      "credentials": {
        "zohoOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "912fb40b-7306-4bd7-83e6-001311124592",
      "name": "Get Ticket History",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        816,
        48
      ],
      "parameters": {
        "resource": "contact",
        "contactId": "={{ $('Get Customer Record').item.json.id }}",
        "operation": "get"
      },
      "credentials": {
        "zohoOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fb55df13-4907-47cf-8caa-15a3ba784400",
      "name": "Analyze Ticket Patterns",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        48
      ],
      "parameters": {
        "text": "=Current Ticket:\nCase ID: {{ $('Webhook Trigger').item.json.body.CaseId }}\nCase Number: {{ $('Webhook Trigger').item.json.body.CaseNumber }}\nSubject: {{ $('Webhook Trigger').item.json.body.Subject }}\nDescription: {{ $('Webhook Trigger').item.json.body.Description }}\nPriority: {{ $('Webhook Trigger').item.json.body.Priority }}\nStatus: {{ $('Webhook Trigger').item.json.body.Status }}\nCustomer Email: {{ $('Webhook Trigger').item.json.body.Email }}\n\nCustomer History:\n{{ $json }}",
        "options": {
          "systemMessage": "You are a sales intelligence analyst specializing in support ticket analysis.\n\nYour task is to:\n1. Analyze the customer support ticket history and current ticket\n2. Identify patterns such as recurring issues, feature requests, or product limitations\n3. Assess customer sentiment and engagement level\n4. Determine if there are upsell opportunities based on:\n   - Repeated requests for premium features\n   - Usage patterns indicating growth\n   - Pain points that premium products could solve\n   - Frequency and complexity of support tickets\n5. Calculate an upsell score from 0-10\n6. Provide specific product recommendations if applicable\n\nReturn your analysis in the structured JSON format."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "f1c0e66c-6785-4b1f-928b-a870d9b61620",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1536,
        288
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"upsellScore\": {\n      \"type\": \"number\",\n      \"description\": \"Score from 0-10 indicating upsell potential\"\n    },\n    \"hasOpportunity\": {\n      \"type\": \"boolean\",\n      \"description\": \"Whether an upsell opportunity exists\"\n    },\n    \"patterns\": {\n      \"type\": \"string\",\n      \"description\": \"Key patterns identified in ticket history\"\n    },\n    \"recommendations\": {\n      \"type\": \"string\",\n      \"description\": \"Specific product or service recommendations\"\n    },\n    \"reasoning\": {\n      \"type\": \"string\",\n      \"description\": \"Detailed reasoning for the upsell assessment\"\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "b5989543-afc8-4ebe-8e37-2b2bc08dde44",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -608,
        48
      ],
      "parameters": {
        "path": "support-ticket",
        "options": {
          "responseData": ""
        },
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "1fd2b964-92b8-4ab2-8f00-03bf6f9eb553",
      "name": "Upsell Opportunity?",
      "type": "n8n-nodes-base.if",
      "position": [
        2224,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "df6f3d44-08d1-4188-a2e7-dd94e3d29e80",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.hasOpportunity }}",
              "rightValue": ""
            },
            {
              "id": "1c253df8-ce06-494a-ae96-990603deed9f",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.output.upsellScore }}",
              "rightValue": "={{ $('Workflow Configuration').item.json.upsellThreshold}}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3e085ca5-8b87-4203-97a6-c69bf68e540d",
      "name": "Alert Account Manager",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2544,
        32
      ],
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').item.json.accountManagerEmail }}",
        "message": "=<h2>Upsell Opportunity Detected</h2> <p><strong>Customer:</strong> {{ $('Webhook Trigger').item.json.body.CaseOwner }}</p> <p><strong>Email:</strong> {{ $('Webhook Trigger').item.json.body.Email }}</p> <p><strong>Case Number:</strong> {{ $('Webhook Trigger').item.json.body.CaseNumber }}</p> <p><strong>Subject:</strong> {{ $('Webhook Trigger').item.json.body.Subject }}</p> <p><strong>Upsell Score:</strong> {{ $json.upsellScore }}/10</p>  <h3>Patterns Identified:</h3> <p>{{ $json.patterns }}</p>  <h3>Recommendations:</h3> <p>{{ $json.recommendations }}</p>  <h3>Analysis:</h3> <p>{{ $json.reasoning }}</p>  <h3>Ticket Details:</h3> <p><strong>Priority:</strong> {{ $('Webhook Trigger').item.json.body.Priority }}</p> <p><strong>Status:</strong> {{ $('Webhook Trigger').item.json.body.Status }}</p> <p><strong>Description:</strong> {{ $('Webhook Trigger').item.json.body.Description }}</p>  <p><em>This alert was generated automatically based on support ticket analysis.</em></p>",
        "options": {},
        "subject": "=Upsell Opportunity: {{ $('Webhook Trigger').item.json.body.CaseOwner }} - Case #{{ $('Webhook Trigger').item.json.body.CaseNumber }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "50f5920b-2fc8-4306-8dc7-763d3eafc7a2",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1312,
        288
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0af08391-fc27-4410-b0f9-98bb60da3859",
      "name": "Customer Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        304,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "df6f3d44-08d1-4188-a2e7-dd94e3d29e80",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "26f78ef4-4d9e-4931-8dc4-1e3028ff698e",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        -240
      ],
      "parameters": {
        "width": 496,
        "height": 608,
        "content": "# How It Works\n### This workflow automates support ticket analysis by syncing incoming data with Zoho CRM and using AI to identify customer sentiment and high-potential upsell opportunities.\n# Setup Steps\n## Trigger\nPoint your support platform\u2019s POST requests to the n8n Webhook URL.\n\n## Connections\nLink credentials for Zoho CRM (data), OpenAI (AI) and Gmail (alerts).\n\n## Configuration\nSet your alert email and upsell score threshold and replace the Zoho CRM placeholder with your specific \"Last Ticket\" Field ID.\n\n## Notifications\nThe system filters results and sends a detailed email only when the AI detects an opportunity meeting your criteria."
      },
      "typeVersion": 1
    },
    {
      "id": "c7ca76f4-c830-4ef9-8999-b234740f8c7f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 512,
        "content": "## Webhook Trigger on On Ticket Add/Edit & Set Configuration\nThe automation process begins with a Webhook Trigger that listens for incoming POST requests containing support ticket details such as subject, description and status. This is immediately followed by a Workflow Configuration node which establishes global parameters, such as a designated email for notifications and a numerical threshold used to determine if an AI-analyzed ticket qualifies as a significant upsell opportunity.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1442106d-dd21-4639-a36a-bfa57145894e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 1008,
        "height": 576,
        "content": "## CRM Data Synchronization and History Retrieval\nThis section of the workflow manages Zoho CRM data synchronization by searching for a matching customer record, verifying its existence through a conditional check and then updating that record with the current timestamp to track the latest ticket activity before retrieving the customer's full history for analysis.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c6e053e7-7211-4822-97d0-b4a24b6c60ab",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 864,
        "height": 640,
        "content": "## AI-Driven Ticket Analysis and Pattern Recognition\nThis segment utilizes an AI Agent powered by a large language model to evaluate current support tickets and historical customer data to identify recurring patterns, sentiment and potential revenue opportunities. A structured output parser then formats these insights into a standardized data object containing a numerical upsell score, specific product recommendations and detailed reasoning for further automation.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "445044cc-6204-4dff-9f63-061e7dcdf563",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 784,
        "height": 544,
        "content": "## Opportunity Filtering and Stakeholder Notification\nThis final stage filters the AI's findings by verifying if a legitimate opportunity exists and if the calculated score meets the predefined threshold. Upon validation, it automatically generates a detailed email alert to the account manager, containing the full situational analysis and product recommendations to facilitate immediate follow-up.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1046637d-2b1b-4250-91a6-d65b6e831b55",
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer Exists?": {
      "main": [
        [
          {
            "node": "Update Customer Record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Customer Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Ticket Patterns",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Ticket History": {
      "main": [
        [
          {
            "node": "Analyze Ticket Patterns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer Record": {
      "main": [
        [
          {
            "node": "Customer Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsell Opportunity?": {
      "main": [
        [
          {
            "node": "Alert Account Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Customer Record": {
      "main": [
        [
          {
            "node": "Get Ticket History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Customer Record": {
      "main": [
        [
          {
            "node": "Get Ticket History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Get Customer Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Ticket Patterns": {
      "main": [
        [
          {
            "node": "Upsell Opportunity?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Ticket Patterns",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}