{
  "name": "Automate stale deal follow-ups in Salesforce with GPT-5.1, email, Slack & tasks",
  "nodes": [
    {
      "id": "e9d9200c-3696-4f76-b04b-9472c205a39a",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1936,
        -976
      ]
    },
    {
      "id": "62cf078e-066a-492d-9882-c8dac3ea5baf",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -1728,
        -976
      ]
    },
    {
      "id": "8a0f4a2f-9339-4de1-a614-e00ef8298139",
      "name": "Perform a query",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -1488,
        -976
      ]
    },
    {
      "id": "7ba41db7-0f84-4cd3-8a19-b0ea640601b5",
      "name": "Get an opportunity",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -1264,
        -976
      ]
    },
    {
      "id": "75389940-46a3-4512-aca9-b8c21bab5f9b",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1040,
        -976
      ]
    },
    {
      "id": "29cfe789-91e7-48ef-8f5f-b7e15275b883",
      "name": "query_soql",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -896,
        -736
      ]
    },
    {
      "id": "33b39d65-3f0e-4f4d-ba59-6770bd21a831",
      "name": "Create Task",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -336,
        -720
      ]
    },
    {
      "id": "cd24d4f9-9d47-4994-9b0a-26253ec5f7cd",
      "name": "Parse JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        -720,
        -976
      ]
    },
    {
      "id": "7f5a791d-7a0e-42ec-b46e-599aa85c458b",
      "name": "Send Email SMTP Customer",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -336,
        -1312
      ]
    },
    {
      "id": "c9998bd2-6222-45b0-917e-b9cb1a7948b1",
      "name": "Send Message To Internal Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        -336,
        -1024
      ]
    },
    {
      "id": "850f5ec2-aa83-404f-be88-dbdec5524889",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2336,
        -1600
      ],
      "parameters": {
        "width": 320,
        "height": 368,
        "content": "**Stale Opportunity Follow-Up – Email, Slack & Task**\n\nThis flow automatically follows up on Salesforce Opportunities whose stage hasn’t changed for a configured number of days. Each morning at 8:00, "
      }
    },
    {
      "id": "8e038257-2fab-47c1-9765-5ae9f43db833",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2336,
        -1200
      ],
      "parameters": {
        "width": 320,
        "height": 832,
        "content": "**Setup & Testing Instructions**\n\n1. Create the `Stage_Unchanged_Days__c` field on Opportunity:\n   - Type: Formula (Number, 0 decimal places)  \n   - Formula:  \n     `IF(ISBLANK(LastStageChangeDate), T"
      }
    },
    {
      "id": "42812b94-f828-4e1c-b7fa-befaa60352b0",
      "name": "Sticky Note – Actions Summary",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -1424
      ],
      "parameters": {
        "width": 736,
        "height": 896,
        "content": "## Send Email (SMTP)\nUses `email.to`, `email.subject`, `email.body` to email the customer.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Slack – Internal Update\nPosts a short stale-opportunity summary to the selected Slack chann"
      }
    },
    {
      "id": "eb1c4494-2e32-4dd3-915f-49395db2694f",
      "name": "Sticky Note – AI Engine1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        -1168
      ],
      "parameters": {
        "width": 544,
        "height": 640,
        "content": "## AI Follow-Up Engine\nCalls the model with Opportunity data and the `query_soql` tool, then parses JSON into `email`, `sms`, `slack`, and `task.api_body`. Central brain and guardrail between AI and S"
      }
    },
    {
      "id": "bcbb9e81-302e-4370-8bea-fd2389ab23af",
      "name": "Sticky Note – Schedule & Threshold",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1984,
        -1168
      ],
      "parameters": {
        "width": 400,
        "height": 416,
        "content": "## Schedule & Stale Threshold\nRuns the flow on a schedule (default 8:00) and sets `stale_days` for the SOQL filter. Adjust the schedule or `stale_days` value here to match your follow-up policy.\n"
      }
    },
    {
      "id": "fd995303-b70e-4534-a038-70da75dbf451",
      "name": "Sticky Note – Opportunity Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        -1168
      ],
      "parameters": {
        "width": 464,
        "height": 416,
        "content": "## Salesforce Opportunity Fetch\nQueries Salesforce for open Opportunities whose stage is unchanged for `stale_days`, excluding closed deals, then loads full Opportunity details for each match. This de"
      }
    }
  ],
  "connections": {
    "Parse JSON": {
      "main": [
        [
          {
            "node": "Send Email SMTP Customer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create Task",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Message To Internal Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "query_soql": {
      "ai_tool": [
        [
          {
            "node": "Message a model",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create Task": {
      "main": [
        []
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Perform a query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Parse JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perform a query": {
      "main": [
        [
          {
            "node": "Get an opportunity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get an opportunity": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email SMTP Customer": {
      "main": [
        []
      ]
    }
  }
}