AutomationFlowsEmail & Gmail › AI Deal Content Recommendation with Zoho CRM

AI Deal Content Recommendation with Zoho CRM

Original n8n title: Ai-powered Deal Content Recommendation and Personalization

AI-Powered Deal Content Recommendation and Personalization. Uses zohoCrm, httpRequest, openAi, gmail. Webhook trigger; 16 nodes.

Webhook trigger★★★★☆ complexityAI-powered16 nodesZoho CrmHTTP RequestOpenAIGmail
Email & Gmail Trigger: Webhook Nodes: 16 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Gmail → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "PZkSWnNFRDv3biI3",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Deal Content Recommendation and Personalization",
  "tags": [],
  "nodes": [
    {
      "id": "cb00534f-1ac7-49b2-9fa5-a10dc7b9054b",
      "name": "Deal Stage Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1280,
        32
      ],
      "parameters": {
        "path": "dd1dc1ed-ce98-4ea7-9d1c-5486c997c413",
        "options": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "12d7a2bb-b098-448f-87b7-f5f3084db192",
      "name": "Fetch Deal Details (Zoho CRM)",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        -1088,
        32
      ],
      "parameters": {
        "dealId": "",
        "resource": "deal",
        "operation": "get"
      },
      "credentials": {
        "zohoOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "263a09b9-c926-4bcf-aa5c-db68741e907f",
      "name": "Extract Deal Context",
      "type": "n8n-nodes-base.code",
      "position": [
        -912,
        32
      ],
      "parameters": {
        "jsCode": "const deal = items[0].json;\n\nreturn [\n  {\n    json: {\n      dealId: deal.id,\n      dealName: deal.Deal_Name,\n      stage: deal.Stage,\n      amount: deal.Amount,\n      description: deal.Description,\n      leadSource: deal.Lead_Source,\n      contactName: deal.Contact_Name?.name,\n      accountName: deal.Account_Name?.name,\n      // you can add more fields here if needed\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "382b5ea9-4e3f-4e91-8bd5-aa8e0c70bdf3",
      "name": "Set Content API Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -592,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "caseStudiesApiUrl",
              "type": "string",
              "value": "https://jsonplaceholder.typicode.com/posts"
            },
            {
              "id": "id-2",
              "name": "whitepapersApiUrl",
              "type": "string",
              "value": "https://jsonplaceholder.typicode.com/comments"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "32602c85-2a66-4bee-afd2-6107a7ea89f6",
      "name": "Fetch Case Studies API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -368,
        -64
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.caseStudiesApiUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "cb5523d5-c027-4093-ace1-2e1e31a99840",
      "name": "Fetch Whitepapers API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -368,
        128
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.whitepapersApiUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "00662e1a-c7be-41b4-a87e-2e4ffd989bd8",
      "name": "Merge Content Datasets",
      "type": "n8n-nodes-base.merge",
      "position": [
        -144,
        32
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "96db25d0-f7ac-4e36-9147-41e39fae8e01",
      "name": "Build Combined Content Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        32
      ],
      "parameters": {
        "jsCode": "// Create an empty object\nconst combinedItem = {};\n\n// Merge all incoming items (only real JSON objects)\nfor (const item of items) {\n    if (item && item.json) {\n        Object.assign(combinedItem, item.json);\n    }\n}\n\n// ---- SAFE DEAL CONTEXT ----\nlet dealData = null;\ntry {\n    const dealNode = $(\"Extract Deal Context\");\n    dealData = dealNode?.item?.json ?? null;\n} catch (e) {\n    dealData = null;\n}\ncombinedItem.dealContext = dealData ? [dealData] : [];\n\n// ---- SAFE LEAD CONTEXT ----\nlet leadData = null;\ntry {\n    const leadNode = $(\"Lead Context\");\n    leadData = leadNode?.item?.json ?? null;\n} catch (e) {\n    leadData = null;\n}\n\n// return merged output\nreturn [{ json: combinedItem }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e937bf3a-4b64-4c39-8d91-fa6ade12b92a",
      "name": "Prepare AI Prompt Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        304,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "237518c1-b647-46fc-90b0-f41e86480277",
              "name": "Deal Context",
              "type": "string",
              "value": "={{ $json.dealContext }}"
            },
            {
              "id": "981d586f-cae5-4985-b164-da7d5594bdd1",
              "name": "Case Studies Data",
              "type": "string",
              "value": "={{ $json.caseStudiesData }}"
            },
            {
              "id": "c172ae1b-15a6-4c77-bbaa-56eb49d7ee34",
              "name": "White Paper Data",
              "type": "string",
              "value": "={{ $json.whitepapersData }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "14061819-c48d-4dd5-b86a-df2180765f44",
      "name": "Generate AI Content Recommendations",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        672,
        32
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=You are a content recommendation engine for Zoho CRM.\n\nUsing the deal context, case studies, and whitepaper data provided:\n\n\n1. Identify the most relevant case studies based on:\n   - Industry match\n   - Pain points\n   - Deal stage\n   - Business type (new/existing)\n   - Description keywords\n\n2. Identify the most relevant whitepapers using:\n   - Industry relevance\n   - Target audience (C-Suite, technical teams)\n   - Focus topic\n   - Deal description keywords\n\n3. Create a structured JSON response:\n{\n  \"recommendedCaseStudies\": [...],\n  \"recommendedWhitepapers\": [...],\n  \"emailContent\": {\n      \"subject\": \"\",\n      \"bodyHtml\": \"\",\n      \"bodyText\": \"\"\n  }\n}\n\n4. The email should:\n   - Reference the deal name and contact\n   - Mention how the resources address their pain points\n   - Include links/titles of recommended case studies and whitepapers\n   - Use a professional B2B tone\n}\n {{ $json[\"Deal Context\"] }}\n{{ $json[\"Case Studies Data\"] }}\n{{ $json[\"White Paper Data\"] }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e2d5f0b7-da07-4e69-a5ee-fabd8e8ec9c5",
      "name": "Parse AI JSON Output",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        32
      ],
      "parameters": {
        "jsCode": "// Get AI text output (the part inside ```json ... ```)\nconst raw = items[0].json.output[0].content[0].text;\n\n// Extract JSON inside code block\nconst jsonMatch = raw.match(/```json([\\s\\S]*?)```/);\n\nif (!jsonMatch) {\n  throw new Error(\"No JSON found in AI output\");\n}\n\n// Parse clean JSON text\nconst jsonString = jsonMatch[1].trim();\nconst parsed = JSON.parse(jsonString);\n\n// Return parsed JSON as clean structured output\nreturn [\n  {\n    json: parsed\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "cc99bf21-364b-43ec-999f-f6b1eeb2cac9",
      "name": "Send Personalized Email (Gmail)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1184,
        32
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.emailContent.bodyHtml }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.emailContent.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "890aa027-1ceb-4fbb-860b-d391d007a436",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        -672
      ],
      "parameters": {
        "width": 448,
        "height": 656,
        "content": "## How It Works\nThis workflow processes deal updates from Zoho CRM and automatically generates personalized content recommendations. When a deal reaches a specific stage, Zoho CRM sends the Deal ID to the n8n Webhook. The workflow then fetches complete deal details such as name, stage, amount, description, contact, and account information.\n\nIt also retrieves two content datasets\u2014case studies and whitepapers\u2014from the configured API endpoints. All data is merged and sent to an OpenAI model, which analyzes the deal context and selects the most relevant resources. The AI then generates a tailored email draft that includes recommended case studies and whitepapers. Finally, the workflow parses the AI output and sends the personalized email to the intended recipient using Gmail.\n\n## Setup Steps\n1.Import the workflow JSON into your n8n instance.\n2.Configure your Webhook URL and link it to a Zoho CRM workflow rule that passes the Deal ID.\n3.Add credentials for Zoho CRM, OpenAI, and Gmail in n8n.\n4.Update the case study and whitepaper API endpoints inside the \u201cSet Content API Config\u201d node.\n5.Replace the test Deal ID in the Zoho CRM node with a dynamic expression referencing the webhook data.\n6.Activate the workflow and test by advancing a deal stage in Zoho CRM.\nThis completes the setup, and the workflow begins delivering AI-powered recommendations automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "a3001c4c-2617-4f1d-a2c5-91e77c9c3dfb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 480,
        "content": "## Deal Trigger & Data Retrieval\n### Captures the Deal ID from Zoho CRM when a stage changes and retrieves complete deal details, including name, stage, description, and contact information. This ensures the workflow begins with accurate, real-time context for personalized content generation."
      },
      "typeVersion": 1
    },
    {
      "id": "d1797b67-a6e0-45fd-95fd-983e0667e2da",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 1136,
        "height": 480,
        "content": "## Content Fetching & Data Preparation\n### Fetches case studies and whitepapers from configured APIs, then merges them with the deal context. The combined data is structured and cleaned to provide the AI model with a clear, comprehensive dataset for producing accurate content recommendations."
      },
      "typeVersion": 1
    },
    {
      "id": "1e5614a8-5cfb-471e-8b07-b32549947ec5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 480,
        "content": "## AI Recommendation & Email Delivery\n### Sends the prepared data to an AI model to generate tailored content recommendations and a personalized email draft. The response is parsed and automatically emailed to the intended recipient, ensuring timely and relevant communication."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0b7f0465-4233-40a4-bcd4-7c0efc511438",
  "connections": {
    "Extract Deal Context": {
      "main": [
        [
          {
            "node": "Set Content API Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI JSON Output": {
      "main": [
        [
          {
            "node": "Send Personalized Email (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Whitepapers API": {
      "main": [
        [
          {
            "node": "Merge Content Datasets",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Fetch Case Studies API": {
      "main": [
        [
          {
            "node": "Merge Content Datasets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Content Datasets": {
      "main": [
        [
          {
            "node": "Build Combined Content Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Content API Config": {
      "main": [
        [
          {
            "node": "Fetch Whitepapers API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Case Studies API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare AI Prompt Fields": {
      "main": [
        [
          {
            "node": "Generate AI Content Recommendations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deal Stage Webhook Trigger": {
      "main": [
        [
          {
            "node": "Fetch Deal Details (Zoho CRM)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Deal Details (Zoho CRM)": {
      "main": [
        [
          {
            "node": "Extract Deal Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Combined Content Payload": {
      "main": [
        [
          {
            "node": "Prepare AI Prompt Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Content Recommendations": {
      "main": [
        [
          {
            "node": "Parse AI JSON Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

How this works

This workflow harnesses AI to recommend and personalise deal content, ensuring sales teams deliver highly relevant materials that boost engagement and close rates faster. It targets sales professionals managing leads in Zoho CRM who want to automate content selection based on deal specifics, saving hours of manual searching. The key step involves OpenAI analysing deal context alongside fetched case studies and whitepapers to generate tailored recommendations, which are then emailed via Gmail for immediate use.

Use this workflow when deals progress through stages in Zoho CRM and you need quick, context-aware content suggestions to nurture prospects effectively. Avoid it for simple, low-volume sales processes where basic templates suffice, or if your CRM lacks webhook support. Common variations include swapping OpenAI for another AI service or adding Slack notifications instead of email for team alerts.

About this workflow

AI-Powered Deal Content Recommendation and Personalization. Uses zohoCrm, httpRequest, openAi, gmail. Webhook trigger; 16 nodes.

Source: https://github.com/Okaykar/n8n-Generate-personalized-deal-content-recommendations-with-Zoho-CRM-GPT-4o-mini-Gmail/blob/main/main.json — original creator credit. Request a take-down →

More Email & Gmail workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Email & Gmail

✨🔪 Advanced AI Powered Document Parsing & Text Extraction with Llama Parse. Uses gmail, gmailTrigger, limit, stickyNote. Webhook trigger; 54 nodes.

Gmail, Gmail Trigger, HTTP Request +6
Email & Gmail

This n8n template automatically processes inbound form leads, researches their company via their website, and uses AI to write and send a highly personalized "speed to lead" email instantly. It also t

Airtable, HTTP Request, OpenAI +2
Email & Gmail

Process CV with AI. Uses gmailTrigger, gmail, splitInBatches, extractFromFile. Event-driven trigger; 48 nodes.

Gmail Trigger, Gmail, Airtable +2
Email & Gmail

Create viral TikTok videos effortlessly — no editing skills required!

HTTP Request, OpenAI, Form Trigger +6
Email & Gmail

Stop finding out you're out of stock after a customer already tried to buy. This workflow monitors your entire product inventory daily, calculates how fast each SKU is selling, and automatically raise

Google Sheets, HTTP Request, Gmail +1