{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "78aa0195-9d08-481b-a5f0-d08a7cab7b73",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -864,
        2224
      ],
      "parameters": {
        "path": "351ffe7c-69f2-4657-b593-c848d59205c0",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "1b2b5847-90a9-4278-a933-51af89a1e6fa",
      "name": "Edit Fields2",
      "type": "n8n-nodes-base.set",
      "position": [
        -656,
        2240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d804175b-c363-4564-a265-b639ed502251",
              "name": "body.message.artifact.transcript",
              "type": "string",
              "value": "={{ $json.body.message.artifact.transcript }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2fd691c2-64dc-4538-a07a-67add1782c84",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -64,
        2400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fbe03bb4-e417-4e15-9e08-1f0ef38e415c",
      "name": "Evaluate Candidate",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -256,
        1968
      ],
      "parameters": {
        "text": "=Transcript: {{ $json.body.message.artifact.transcript }}",
        "options": {
          "systemMessage": "You are an AI assistant that reviews phone\u2011screen transcripts for a $17\u202fper\u202fhour  driving job in Massachusetts.\n\nINPUT  \n\u2022 A single variable named  transcript  containing the full, verbatim conversation between \u201cWill\u201d (the interviewer) and the caller.\n\nEVALUATION CRITERIA  \nA candidate qualifies **only if every box below is satisfied** (case\u2011insensitive search is acceptable):\n\n1. \u2751  They affirmed having a **valid, non\u2011expired, non\u2011suspended Massachusetts driver\u2019s license**.  \n2. \u2751  They reported **NO felony convictions**.  \n3. \u2751  They reported **NO tickets or accidents in the last few years** (responses such as \u201cnone,\u201d \u201cclean record,\u201d etc., count as a pass).  \n4. \u2751  They **agreed to a background check**.  \n5. \u2751  They **stated they can pass a drug test with zero tolerance \u2014 including marijuana**.  \n6. \u2751  They are **available to work full\u2011time Monday\u2013Friday**.  \n7. \u2751  They **live in Massachusetts** (the transcript must mention a city/town **and** \u201cMA\u201d or \u201cMassachusetts\u201d).\n\nIf any box is unchecked,  \"qualifies\"  must be  false  and the  \"reasoning\"  field must state exactly which box(es) failed.\n\nOUTPUT  \nReturn **only** the following JSON object (no additional text, no Markdown, no code block, if one is unknown, just put unknown):\n\n{\n  \"name\": \"First Last\",\n  \"phone\": \"8881231253\",\n  \"cityState\": \"City, state\",\n  \"qualifies\": \"true/false\",\n  \"reasoning\": \"1\u20132 concise sentences explaining why the candidate does or does not qualify\"\n}\n\nRULES  \n\u2022 If any of the first three fields are missing, write `\"unknown\"` (string).  \n\u2022 \"qualifies\" must be a boolean value (true or false).  \n\u2022 When \"qualifies\" is false, the reasoning must reference the specific criterion/criteria that were not met.  \n\u2022 Output **nothing** except the JSON object described above.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "af1465a3-977d-427f-9066-d01cbd3df117",
      "name": "Convert to JSON",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -16,
        2240
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "options": {
          "systemMessage": "convert this into valid json only. outupt this format. {\n  \"name\": \"<First Last\",\n  \"phone\": \"8881231253\",\n  \"cityState\": \"City, State\",\n  \"qualifies\": \"True/False\",\n  \"reasoning\": \"1\u20112 concise sentences summarizing why they do or do not qualify\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "b915252b-f1ed-483c-bfd0-6186252f74ac",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        272,
        2000
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $json.output.name }}",
            "phone": "={{ $json.output.phone }}",
            "cityState": "={{ $json.output.cityState }}",
            "qualifies": "={{ $json.output.qualifies }}",
            "reasoning": "={{ $json.output.reasoning }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cityState",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cityState",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "qualifies",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "qualifies",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reasoning",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "reasoning",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": " ",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": " ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18W1ZzPM__foVNjeapuxnon0ZtgxaQjncNaamuZOdUSo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "18W1ZzPM__foVNjeapuxnon0ZtgxaQjncNaamuZOdUSo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18W1ZzPM__foVNjeapuxnon0ZtgxaQjncNaamuZOdUSo/edit?usp=drivesdk",
          "cachedResultName": "Drivers"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "1773d0ac-aaba-4aa7-a262-6e35c8827e63",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        1440
      ],
      "parameters": {
        "width": 1932,
        "content": "## \ud83d\udcec Need Help or Want to Customize This?\n\ud83d\udce7 [rbreen@ynteractive.com](mailto:robert@ynteractive.com)  \n\ud83d\udd17 [LinkedIn](https://www.linkedin.com/in/robert-breen-29429625/)"
      },
      "typeVersion": 1
    },
    {
      "id": "f190cfef-15e6-47f8-ac04-bd3ce11ee046",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        1632
      ],
      "parameters": {
        "color": 6,
        "width": 700,
        "height": 860,
        "content": "\n### Step 4: Customize Evaluation Criteria\n\nThe workflow includes predefined criteria for a Massachusetts driving job. To customize for your needs:\n\n1. Click on the \"Evaluate Candidate\" node\n2. Modify the system message to include your specific requirements\n3. Update the evaluation criteria checklist\n4. Adjust the JSON output format if needed\n\n\n### Step 5: Connect to Vapi.ai (Phone Interview System)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bfe5cac4-a516-4ead-afff-5f5d05f65ae2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        1632
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 860,
        "content": "\n## Prerequisites\n\nBefore implementing this workflow, you'll need:\n\n1. **N8N Instance** - Self-hosted or cloud version\n2. **OpenAI API Account** - For AI transcript processing\n3. **Google Account** - For Google Sheets integration\n4. **Phone Interview System** - That can send webhooks (like Vapi.ai)\n\n## Step-by-Step Setup Instructions\n\n### Step 1: Set Up OpenAI API Access\n\n1. Visit [OpenAI's API platform](https://platform.openai.com/)\n2. Create an account or log in\n3. Navigate to API Keys section\n4. Generate a new API key\n5. Copy and securely store your API key\n\n### Step 2: Create Your Google Sheet\n\n**Option 1: Use Our Pre-Made Template (Recommended)**\n1. Copy our template: [Driver Interview Results Template](https://docs.google.com/spreadsheets/d/18W1ZzPM__foVNjeapuxnon0ZtgxaQjncNaamuZOdUSo/edit?usp=sharing)\n2. Click \"File\" \u2192 \"Make a copy\" to create your own version\n3. Rename it as desired\n4. Copy your new sheet's URL - you'll need this for the workflow\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4b2c9f63-5851-4dec-b156-2cbf06330891",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        1632
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 860,
        "content": "\n\n### Step 3: Import and Configure the N8N Workflow\n\n1. **Import the Workflow**\n   - Copy the workflow JSON from the template\n   - In your N8N instance, go to Workflows \u2192 Import from JSON\n   - Paste the JSON and import\n\n2. **Configure OpenAI Credentials**\n   - Click on either \"OpenAI Chat Model\" node\n   - Set up credentials using your OpenAI API key\n   - Test the connection to ensure it works\n\n3. **Configure Google Sheets Integration**\n   - Click on the \"Save to Google Sheets\" node\n   - Set up Google Sheets OAuth2 credentials\n   - Select your spreadsheet from the dropdown\n   - Choose the correct sheet (usually \"Sheet1\")\n\n4. **Update the Webhook**\n   - Click on the \"Webhook\" node\n   - Note the webhook URL that n8n generates\n   - This URL will receive your transcript data\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "66a9250b-96c3-4697-9acc-9587e082fea0",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -192,
        2144
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "402cdf88-4a69-4f40-bd9e-2fb4da0f73ee",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        192,
        2384
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"name\": \"<First Last\",\n  \"phone\": \"8881231253\",\n  \"cityState\": \"City, State\",\n  \"qualifies\": \"True/False\",\n  \"reasoning\": \"1\u20112 concise sentences summarizing why they do or do not qualify\"\n}"
      },
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Evaluate Candidate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Candidate": {
      "main": [
        [
          {
            "node": "Convert to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Evaluate Candidate",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Convert to JSON",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Convert to JSON",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}