{
  "name": "Automate B2B SaaS renewal risk management with CRM, support & usage data",
  "nodes": [
    {
      "id": "49dfb1d2-fdbe-4194-bebe-0d4f238e36a8",
      "name": "analytivcs",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        -1040
      ]
    },
    {
      "id": "2560c73a-16ad-4562-9220-d7d551cc610c",
      "name": "Get data related to an organization",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        1008,
        -1216
      ]
    },
    {
      "id": "15771604-4a77-4949-a795-7ad36c9ff49e",
      "name": "daily trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -416,
        -656
      ]
    },
    {
      "id": "5bee940e-4d55-4e9c-994a-a6d05ea7a6a2",
      "name": "Init config & thresholds",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        -656
      ]
    },
    {
      "id": "246b9e8f-90cc-406d-bd25-299af7d82c5e",
      "name": "Fetch subscriptions expiring in J+30",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -80,
        -656
      ]
    },
    {
      "id": "33147bfe-52fd-41ee-8660-dc7e24ef16cd",
      "name": "Process subscriptions in batches",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        176,
        -656
      ]
    },
    {
      "id": "929935d7-d621-459d-9c88-3462be51ecb0",
      "name": "HubSpot – Get engagement history",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1008,
        -160
      ]
    },
    {
      "id": "3e4ea5c2-bbd9-47ac-b349-b4cd41ad3560",
      "name": "Salesforce – Get account details",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        1008,
        -336
      ]
    },
    {
      "id": "fef8bece-356e-4725-a9a6-e20bb29fb241",
      "name": "Pipedrive – Get deal activities",
      "type": "n8n-nodes-base.pipedrive",
      "position": [
        1008,
        -512
      ]
    },
    {
      "id": "28368900-b3f3-413d-8b75-8d203b3dcc8d",
      "name": "Pipedrive – Get deal products",
      "type": "n8n-nodes-base.pipedrive",
      "position": [
        1008,
        -688
      ]
    },
    {
      "id": "d5e39346-2718-4fa1-87e1-2d03a532449a",
      "name": "Analytics API – Feature usage",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        -880
      ]
    },
    {
      "id": "d79baeb7-bb15-4346-b141-39eb85cca84c",
      "name": "Scoring API – Call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1632,
        -752
      ]
    },
    {
      "id": "6d2fa675-a9fa-464f-a1ba-58236528ab6d",
      "name": "Normalize scoring response",
      "type": "n8n-nodes-base.set",
      "position": [
        1952,
        -752
      ]
    },
    {
      "id": "4c931a93-0afe-417b-9a45-aed742d1c0e0",
      "name": "Compute churn score & level",
      "type": "n8n-nodes-base.set",
      "position": [
        2128,
        -752
      ]
    },
    {
      "id": "bc529846-4d68-407c-8f6d-ff463067555d",
      "name": "Route by churn risk (HIGH / MEDIUM / LOW)",
      "type": "n8n-nodes-base.switch",
      "position": [
        2320,
        -768
      ]
    },
    {
      "id": "62b9106e-e07c-4e85-91b1-a97c228c2fe0",
      "name": "Build daily summary",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        4064,
        -768
      ]
    },
    {
      "id": "8c11718d-f6cf-4bb9-8b40-b37020d70829",
      "name": "Email – LOW info",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2832,
        -288
      ]
    },
    {
      "id": "765cd687-4336-41ca-a786-3582d6864da5",
      "name": "Email – CSM/AM HIGH",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3136,
        -1104
      ]
    },
    {
      "id": "8c3b83ce-9b58-429c-98f2-6fdddc9e92ea",
      "name": "Email – CSM/ AM MEDIUM",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3024,
        -752
      ]
    },
    {
      "id": "9510c3d2-f8bb-49ff-b305-7ada910f1f3b",
      "name": "jira ticket",
      "type": "n8n-nodes-base.jira",
      "position": [
        2768,
        -1104
      ]
    },
    {
      "id": "268fb051-179d-4a6a-8294-e731a913e861",
      "name": "Slack notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        2944,
        -1104
      ]
    },
    {
      "id": "0d8efc47-8f7a-483e-98a7-f174ce619eba",
      "name": "Data personalisation",
      "type": "n8n-nodes-base.noOp",
      "position": [
        464,
        -672
      ]
    },
    {
      "id": "50ffe277-88cd-48b5-9c6a-0eeb9f51165e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -1232
      ],
      "parameters": {
        "width": 384,
        "height": 1264,
        "content": "## How it works\n\nThis workflow prevents churn by automatically identifying B2B/SaaS accounts whose licenses will expire in 30 days (J–30), enriching them with CRM, product usage and support data, scor"
      }
    },
    {
      "id": "571f5cec-f32e-4f37-a451-f124cf194439",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -1232
      ],
      "parameters": {
        "width": 2048,
        "height": 1264,
        "content": "## Data flow\n\nEvery morning, the system:\n\n- Queries Postgres to retrieve subscriptions expiring in J–30\n- Enriches each account with data from:\n- HubSpot (engagement)\n- Salesforce (account profile)\n- "
      }
    },
    {
      "id": "3fd9aaeb-800f-47bc-8f28-adc954b86c9c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        -1232
      ],
      "parameters": {
        "width": 2896,
        "height": 1264,
        "content": "## Logging & Extensibility\n\nFor every processed account, the workflow stores a structured log entry in Postgres containing:\n- account_id & name\n- end date\n- riskScore & riskLevel\n- selected playbook\n-"
      }
    },
    {
      "id": "79301630-a202-448a-be94-716d6c8d54c5",
      "name": "Prepare log payload",
      "type": "n8n-nodes-base.set",
      "position": [
        3488,
        -768
      ]
    },
    {
      "id": "32cf2ab9-e202-4452-a7e8-3e759f6f46a1",
      "name": "Build summary line",
      "type": "n8n-nodes-base.set",
      "position": [
        3888,
        -768
      ]
    },
    {
      "id": "1b3a5d38-f973-4165-b674-d07a6f05d527",
      "name": "Engagement call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1792,
        -752
      ]
    },
    {
      "id": "c00d4c50-0f22-4f28-ad8f-2d439554d112",
      "name": "Reporting email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        4272,
        -768
      ]
    },
    {
      "id": "ca443b92-1bb9-49f9-864f-13e660ca5112",
      "name": "prepare daily summary",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3680,
        -768
      ]
    },
    {
      "id": "4af9cfc9-12d6-4f88-88aa-98dad4b56d39",
      "name": "Trello Create MEDIUM risk card1",
      "type": "n8n-nodes-base.trello",
      "position": [
        2672,
        -752
      ]
    },
    {
      "id": "71ae0366-e8cc-4110-be6b-16438d1724a8",
      "name": "Trello Create HIGH risk card",
      "type": "n8n-nodes-base.trello",
      "position": [
        2592,
        -1104
      ]
    },
    {
      "id": "4f66e58c-88c9-4d9d-b8c5-2949460384b2",
      "name": "Data merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1440,
        -832
      ]
    }
  ],
  "connections": {
    "Data merge": {
      "main": [
        [
          {
            "node": "Scoring API – Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "analytivcs": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "jira ticket": {
      "main": [
        [
          {
            "node": "Slack notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "daily trigger": {
      "main": [
        [
          {
            "node": "Init config & thresholds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Engagement call": {
      "main": [
        [
          {
            "node": "Normalize scoring response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build summary line": {
      "main": [
        [
          {
            "node": "Build daily summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email – LOW info": {
      "main": [
        [
          {
            "node": "Prepare log payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack notification": {
      "main": [
        [
          {
            "node": "Email – CSM/AM HIGH",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build daily summary": {
      "main": [
        [
          {
            "node": "Reporting email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare log payload": {
      "main": [
        [
          {
            "node": "prepare daily summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data personalisation": {
      "main": [
        [
          {
            "node": "HubSpot – Get engagement history",
            "type": "main",
            "index": 0
          },
          {
            "node": "Salesforce – Get account details",
            "type": "main",
            "index": 0
          },
          {
            "node": "Pipedrive – Get deal activities",
            "type": "main",
            "index": 0
          },
          {
            "node": "Pipedrive – Get deal products",
            "type": "main",
            "index": 0
          },
          {
            "node": "Analytics API – Feature usage",
            "type": "main",
            "index": 0
          },
          {
            "node": "analytivcs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get data related to an organization",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scoring API – Call": {
      "main": [
        [
          {
            "node": "Engagement call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email – CSM/AM HIGH": {
      "main": [
        [
          {
            "node": "Prepare log payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "prepare daily summary": {
      "main": [
        [
          {
            "node": "Build summary line",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email – CSM/ AM MEDIUM": {
      "main": [
        [
          {
            "node": "Prepare log payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Init config & thresholds": {
      "main": [
        [
          {
            "node": "Fetch subscriptions expiring in J+30",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize scoring response": {
      "main": [
        [
          {
            "node": "Compute churn score & level",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compute churn score & level": {
      "main": [
        [
          {
            "node": "Route by churn risk (HIGH / MEDIUM / LOW)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trello Create HIGH risk card": {
      "main": [
        [
          {
            "node": "jira ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analytics API – Feature usage": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Pipedrive – Get deal products": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Trello Create MEDIUM risk card1": {
      "main": [
        [
          {
            "node": "Email – CSM/ AM MEDIUM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process subscriptions in batches": {
      "main": [
        [
          {
            "node": "Data personalisation",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Pipedrive – Get deal activities": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "HubSpot – Get engagement history": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 6
          }
        ]
      ]
    },
    "Salesforce – Get account details": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 5
          }
        ]
      ]
    },
    "Get data related to an organization": {
      "main": [
        [
          {
            "node": "Data merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch subscriptions expiring in J+30": {
      "main": [
        [
          {
            "node": "Process subscriptions in batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by churn risk (HIGH / MEDIUM / LOW)": {
      "main": [
        [
          {
            "node": "Trello Create HIGH risk card",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Trello Create MEDIUM risk card1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email – LOW info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}