{
  "id": "IEetUVoebokNrPxb",
  "name": "Automate lead qualification calls from Salesforce to Retell AI with OpenAI analysis",
  "tags": [
    {
      "id": "Cl1eHsYeirJh9xXC",
      "name": "salesforce",
      "createdAt": "2025-09-25T14:48:46.184Z",
      "updatedAt": "2025-09-25T14:48:46.184Z"
    },
    {
      "id": "WqlAbE0vrnEFnGlR",
      "name": "retell-ai",
      "createdAt": "2025-09-25T14:48:46.222Z",
      "updatedAt": "2025-09-25T14:48:46.222Z"
    },
    {
      "id": "12vfEq8FpRcUygXu",
      "name": "openai",
      "createdAt": "2025-09-25T14:48:46.239Z",
      "updatedAt": "2025-09-25T14:48:46.239Z"
    },
    {
      "id": "ushFMOectpmGcCTK",
      "name": "lead-qualification",
      "createdAt": "2025-09-25T14:48:46.258Z",
      "updatedAt": "2025-09-25T14:48:46.258Z"
    },
    {
      "id": "SndsxmrXHvpxoPFi",
      "name": "voice-automation",
      "createdAt": "2025-09-25T14:48:46.203Z",
      "updatedAt": "2025-09-25T14:48:46.203Z"
    }
  ],
  "nodes": [
    {
      "id": "8b0f5e59-f1d4-4e40-b1ef-3953728a119e",
      "name": "StickyNote",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        48
      ],
      "parameters": {
        "color": 4,
        "width": 632,
        "height": 668,
        "content": "## \ud83c\udfaf Salesforce AI Voice Sales Agent for Lead Management  \n**Transform your lead qualification process with automated AI-powered phone calls triggered directly from Salesforce lead creation.**\n\n### What this workflow does:\n1. **Webhook Trigger**: Receives new lead data from Salesforce\n2. **Automated Calling**: Initiates phone calls via Retell AI\n3. **Smart Monitoring**: Polls call status until completion\n4. **AI Analysis**: Uses OpenAI to analyze call transcripts\n5. **Salesforce Integration**: Creates follow-up tasks with insights\n\n### Perfect for:\n- Sales teams wanting to qualify leads faster\n- Companies using Salesforce CRM\n- Organizations looking to automate initial prospect outreach\n- Teams wanting AI-powered call analysis\n\n### You'll need:\n- Salesforce org with lead creation triggers\n- Retell AI account and agent setup\n- OpenAI API access\n- Basic n8n workflow knowledge\n\n### Setup time: ~30 minutes\n\n**Author**: Sri Kolagani\n**Template Type**: Free"
      },
      "typeVersion": 1
    },
    {
      "id": "b1e3ca3c-b862-4cc8-86d5-47d184670a99",
      "name": "StickyNote1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 140,
        "content": "### \ud83d\udcde Step 1: Receive Lead Data\nWebhook receives lead information from Salesforce when new leads are created"
      },
      "typeVersion": 1
    },
    {
      "id": "5d71744c-c1f6-4a17-859d-5d3128486d3a",
      "name": "\ud83d\udd17 Receive Salesforce Lead",
      "type": "n8n-nodes-base.webhook",
      "position": [
        368,
        208
      ],
      "parameters": {
        "path": "salesforce-lead",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "cfbe47aa-7b38-44ed-a0b8-73cd38f9414f",
      "name": "StickyNote2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 332,
        "height": 244,
        "content": "### \ud83d\udcf1 Step 2: Initiate Phone Call\nStarts automated call using Retell AI with lead's phone number\n\n**\u2699\ufe0f Setup Required:**\n- Add your Retell AI API key to credentials\n- Update from_number with your phone number\n- Update agent_id with your Retell agent ID"
      },
      "typeVersion": 1
    },
    {
      "id": "3a6395a4-7c13-4a93-a2da-62d5f4ee8642",
      "name": "\ud83d\udcde Start Retell AI Call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        208
      ],
      "parameters": {
        "url": "https://api.retellai.com/v2/create-phone-call",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "from_number",
              "value": "YOUR_RETELL_PHONE_NUMBER"
            },
            {
              "name": "to_number",
              "value": "={{$json.body.Phone}}"
            },
            {
              "name": "agent_id",
              "value": "YOUR_RETELL_AGENT_ID"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{$credentials.retellAI.apiKey}}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dc9d05f2-8c61-4ffd-9d85-56da6972010d",
      "name": "StickyNote3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 252,
        "height": 120,
        "content": "### \u23f1\ufe0f Step 3: Monitor Call Status\nPolls Retell AI API to check if call has ended"
      },
      "typeVersion": 1
    },
    {
      "id": "bd51f99e-e5da-4369-b7a9-d8bf4b64c528",
      "name": "\ud83d\udd0d Check Call Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1136,
        208
      ],
      "parameters": {
        "url": "={{`https://api.retellai.com/v2/get-call/${$node['\ud83d\udcde Start Retell AI Call'].json.call_id}`}}\n",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{$credentials.retellAI.apiKey}}"
            }
          ]
        },
        "nodeCredentialType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "78992ed0-5800-4f73-beb8-cd5ae9280060",
      "name": "StickyNote4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        48
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 120,
        "content": "### \u2705 Step 4: Call Completion Check\nVerifies if call has ended before proceeding to analysis"
      },
      "typeVersion": 1
    },
    {
      "id": "cec948af-4f4a-4c59-82b5-839c77f5fed1",
      "name": "\u2753 Is Call Complete?",
      "type": "n8n-nodes-base.if",
      "position": [
        1360,
        208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "cond1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{$json.body.call_status}}",
              "rightValue": "ended"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "47eb73aa-039f-4fcb-b050-44c37b59e897",
      "name": "StickyNote5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        320
      ],
      "parameters": {
        "color": 7,
        "width": 250,
        "height": 100,
        "content": "### \u23f3 Wait & Retry\nWaits 10 seconds before checking call status again"
      },
      "typeVersion": 1
    },
    {
      "id": "620d9049-7a4f-456c-9006-637a46b30d4b",
      "name": "\u23f1\ufe0f Wait 10 Seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        1360,
        384
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 10
      },
      "typeVersion": 1
    },
    {
      "id": "6166d7df-b0c6-42ed-a1bf-96fc3ffba917",
      "name": "StickyNote6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 316,
        "height": 208,
        "content": "### \ud83e\udde0 Step 5: AI Call Analysis\nOpenAI analyzes the call transcript and extracts key insights\n\n**\u2699\ufe0f Setup Required:**\n- Add your OpenAI API key to credentials\n- Model uses GPT-3.5-turbo (cost-effective)"
      },
      "typeVersion": 1
    },
    {
      "id": "bce9067d-9ef6-43c6-ad91-561babb1c17e",
      "name": "\ud83e\udd16 OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1680,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-3.5-turbo",
          "cachedResultName": "gpt-3.5-turbo"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "afdad610-3138-4524-8b95-d403a0b31469",
      "name": "\ud83c\udfaf Analyze Call Transcript",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1680,
        192
      ],
      "parameters": {
        "text": "=You are a professional sales call summarization assistant.\n\nCall ID: {{$json[\"body\"][\"call_id\"]}}\n\nTranscript:\n{{$json[\"body\"][\"transcript\"]}}\n\nPlease return a structured JSON with the following keys:\n- purpose: Brief description of the call's purpose\n- keyDiscussionPoints: Main topics discussed (array)\n- leadResponses: Lead's key responses and interest level\n- nextActions: Recommended follow-up actions (array)\n- overallOutcome: Success/failure assessment with reasoning\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "36072118-1756-435a-96e0-f9d4a2ce332f",
      "name": "StickyNote7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        -48
      ],
      "parameters": {
        "color": 7,
        "width": 364,
        "height": 208,
        "content": "### \ud83d\udccb Step 6: Create Follow-up Task\nCreates a task in Salesforce with AI analysis results\n\n**\u2699\ufe0f Setup Required:**\n- Connect your Salesforce account via OAuth2\n- Ensure proper Salesforce permissions for task creation"
      },
      "typeVersion": 1
    },
    {
      "id": "01a5fdf5-13d2-46cc-ac63-b917521ad84f",
      "name": "\ud83d\udcdd Create Salesforce Task",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        2096,
        192
      ],
      "parameters": {
        "status": "Not Started",
        "resource": "task",
        "additionalFields": {
          "type": "Call",
          "subject": "=Lead Qualification Call Analysis - {{ $now.toFormat('yyyy-MM-dd HH:mm') }}",
          "description": "={{ $json.output }}"
        }
      },
      "executeOnce": true,
      "notesInFlow": false,
      "typeVersion": 1,
      "alwaysOutputData": false
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f16792a3-b973-4faa-b848-56d603211a92",
  "connections": {
    "\u2753 Is Call Complete?": {
      "main": [
        [
          {
            "node": "\ud83c\udfaf Analyze Call Transcript",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u23f1\ufe0f Wait 10 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u23f1\ufe0f Wait 10 Seconds": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d Check Call Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd0d Check Call Status": {
      "main": [
        [
          {
            "node": "\u2753 Is Call Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udd16 OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "\ud83c\udfaf Analyze Call Transcript",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcde Start Retell AI Call": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d Check Call Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83c\udfaf Analyze Call Transcript": {
      "main": [
        [
          {
            "node": "\ud83d\udcdd Create Salesforce Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd17 Receive Salesforce Lead": {
      "main": [
        [
          {
            "node": "\ud83d\udcde Start Retell AI Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}