AI-Powered Voice & Chat Agent with CRM Automation Overview

    Designed and deployed an end-to-end AI automation system that streamlined customer communication and appointment management, reducing manual workload by 90% while improving lead conversion rates and CRM data accuracy.

    Shared 10/5/2025

    342 views

    Visual Workflow

    JSON Code

    {
      "id": "rIlxiouzXCqLbqNg",
      "meta": {
        "instanceId": "97f7295ef8476e26a21a70e4d59b4e996d3089e5b709980a95afa3efa106827b",
        "templateCredsSetupCompleted": true
      },
      "name": "Appointment Booking and Scheduling",
      "tags": [],
      "nodes": [
        {
          "id": "45d29598-7533-46ee-95a7-7f62cecca321",
          "name": "Webhook",
          "type": "n8n-nodes-base.webhook",
          "position": [
            0,
            380
          ],
          "webhookId": "e8a1faee-e305-4578-8375-230626c86904",
          "parameters": {
            "path": "e8a1faee-e305-4578-8375-230626c86904",
            "options": {},
            "httpMethod": "POST",
            "responseMode": "responseNode"
          },
          "typeVersion": 2
        },
        {
          "id": "6bc58233-ae3d-43b6-9570-f01342b747da",
          "name": "Switch",
          "type": "n8n-nodes-base.switch",
          "position": [
            260,
            360
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "outputKey": "outbound Call",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "97e9bbd3-edba-4f4d-baf7-809bfdece17f",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.query['Event type'] }}",
                        "rightValue": "call-outbound"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Appointment Booking",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "1a9dbcf0-80a4-45ae-b932-a393cdbd1caa",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.body.name }}",
                        "rightValue": "book_appointment_tool"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Inbound Call",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "a9eb1d53-506e-4cb6-89a6-60a45796597a",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.body.event }}",
                        "rightValue": "call_inbound"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Call Ended",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "369bc799-4510-4233-aa83-719ebeeb0c90",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $json.body.event }}",
                        "rightValue": "call_analyzed"
                      }
                    ]
                  },
                  "renameOutput": true
                }
              ]
            },
            "options": {}
          },
          "typeVersion": 3.2
        },
        {
          "id": "ca812f00-1da8-4df0-8aa3-f9042fdaf708",
          "name": "bookAppointment",
          "type": "n8n-nodes-base.httpRequest",
          "onError": "continueRegularOutput",
          "position": [
            1340,
            380
          ],
          "parameters": {
            "url": "https://services.leadconnectorhq.com/calendars/events/appointments",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n  \"calendarId\": \"{{ $('For Call').item.json.calendarId }}\",\n  \"locationId\": \"{{ $('For Call').item.json.locationId }}\",\n  \"contactId\": \"{{ $('For Call').item.json.contactId }}\",\n  \"startTime\": \"{{ $json.message.content.startTime }}\"\n}",
            "sendBody": true,
            "sendHeaders": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-04-15"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "6d752edb-cb5f-41c2-8cbd-1a278f8714e2",
          "name": "addOneDay",
          "type": "n8n-nodes-base.dateTime",
          "position": [
            2000,
            160
          ],
          "parameters": {
            "options": {},
            "duration": 2,
            "magnitude": "={{ $json.startDate }}",
            "operation": "addToDate"
          },
          "typeVersion": 2
        },
        {
          "id": "68d0517b-063e-427c-9e3b-8f391c2ce24a",
          "name": "HTTP Request2",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            340,
            -260
          ],
          "parameters": {
            "url": "https://api.retellai.com/v2/create-phone-call",
            "body": "={{\n  {\n    \"from_number\": $json.body.from_number,\n    \"to_number\": $json.body.to_number,\n    \"retell_llm_dynamic_variables\": {\n      \"customer_name\": $json.body.retell_llm_dynamic_variables.customer_name,\n      \"email\": $json.body.retell_llm_dynamic_variables.email,\n      \"contactId\": $json.body.retell_llm_dynamic_variables.ContactID\n    }\n  }\n}}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "rawContentType": "application/json",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Authorization",
                  "value": "Bearer YOUR_BEARER_TOKEN"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "47e10a07-cbdd-4eb7-a47c-ede00156be4f",
          "name": "Respond to Webhook",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            420,
            1000
          ],
          "parameters": {
            "options": {},
            "respondWith": "json",
            "responseBody": "={\n  \"call_inbound\": {\n    \"dynamic_variables\": {\n        \"contactId\": \"{{ $json.contactId }}\"\n    }\n  }\n}"
          },
          "typeVersion": 1.2
        },
        {
          "id": "41b96060-d8ce-40cf-a787-9590688f2538",
          "name": "creatcontact",
          "type": "n8n-nodes-base.httpRequest",
          "onError": "continueErrorOutput",
          "position": [
            -40,
            1000
          ],
          "parameters": {
            "url": " https://services.leadconnectorhq.com/contacts/",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "bodyParameters": {
              "parameters": [
                {
                  "name": "locationId",
                  "value": "7CXSHcISS8H6LYDZWiva"
                },
                {
                  "name": "phone",
                  "value": "={{ $('Webhook').item.json.body.call_inbound.from_number}}"
                }
              ]
            },
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-04-15"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "936e65bb-e36b-4596-9bbf-f84f3c00d825",
          "name": "End Date",
          "type": "n8n-nodes-base.dateTime",
          "position": [
            2200,
            160
          ],
          "parameters": {
            "date": "={{ $json.newDate }}",
            "format": "x",
            "options": {},
            "operation": "formatDate",
            "outputFieldName": "endDate"
          },
          "typeVersion": 2
        },
        {
          "id": "eb413790-b22e-44b6-9af7-74cf34423a9f",
          "name": "Start Date",
          "type": "n8n-nodes-base.dateTime",
          "position": [
            1800,
            160
          ],
          "parameters": {
            "date": "={{ $('ISO 8601 Formatter').item.json.message.content.startTime }}",
            "format": "x",
            "options": {},
            "operation": "formatDate",
            "outputFieldName": "startDate"
          },
          "typeVersion": 2
        },
        {
          "id": "dc0bc920-ec7f-4f2b-82de-3a0050e32b8f",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1760,
            100
          ],
          "parameters": {
            "color": 2,
            "width": 1040,
            "height": 220,
            "content": "## Getting Available Slots\n"
          },
          "typeVersion": 1
        },
        {
          "id": "721715fd-1711-4d2c-b167-808dd1e2cb34",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1240,
            280
          ],
          "parameters": {
            "color": 6,
            "width": 300,
            "height": 280,
            "content": "## Appointment Booking"
          },
          "typeVersion": 1
        },
        {
          "id": "fea34bc8-1760-4fd5-a371-e258e9b969bb",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            920,
            280
          ],
          "parameters": {
            "color": 5,
            "width": 300,
            "height": 280,
            "content": "## Date Formatting\n### To ISO 8601"
          },
          "typeVersion": 1
        },
        {
          "id": "b5fcafb5-6a2d-48b6-a20f-05f7b2796058",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            720,
            220
          ],
          "parameters": {
            "color": 4,
            "width": 180,
            "height": 360,
            "content": "## Setting IDs"
          },
          "typeVersion": 1
        },
        {
          "id": "4c8e9f4a-1b87-44ae-89c2-fe573fa412cd",
          "name": "Sticky Note4",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            220,
            280
          ],
          "parameters": {
            "color": 2,
            "width": 220,
            "height": 280,
            "content": "## Choosing Functions"
          },
          "typeVersion": 1
        },
        {
          "id": "f9691b4c-3805-4678-b2cf-b004d89f4636",
          "name": "Sticky Note5",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -100,
            860
          ],
          "parameters": {
            "width": 740,
            "height": 400,
            "content": "## Creating Contact"
          },
          "typeVersion": 1
        },
        {
          "id": "03fce670-ba42-4e73-8875-1b9453e1b535",
          "name": "Sticky Note6",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -80,
            -480
          ],
          "parameters": {
            "color": 3,
            "width": 1000,
            "height": 560,
            "content": "## Outbound Calling"
          },
          "typeVersion": 1
        },
        {
          "id": "473d310f-d5fc-4177-bc5d-cbbf1315f919",
          "name": "Sticky Note7",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            2820,
            340
          ],
          "parameters": {
            "color": 3,
            "width": 680,
            "height": 240,
            "content": "## Successful Booking Acknowledgement"
          },
          "typeVersion": 1
        },
        {
          "id": "0c96ed57-9c46-4e34-b25b-ae02eb0fbec3",
          "name": "Sticky Note8",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -100,
            280
          ],
          "parameters": {
            "color": 3,
            "width": 300,
            "height": 280,
            "content": "## Recieving Input\n### Inbound/ Outbound\n### Function calls"
          },
          "typeVersion": 1
        },
        {
          "id": "f093b98c-27fb-46b0-abe2-17e7b0d50426",
          "name": "Sticky Note9",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1860,
            600
          ],
          "parameters": {
            "color": 3,
            "width": 440,
            "height": 240,
            "content": "## Post Call data Ingestion"
          },
          "typeVersion": 1
        },
        {
          "id": "780ec1a0-45f4-4055-ad46-27ff42e1409d",
          "name": "Sticky Note10",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            2820,
            100
          ],
          "parameters": {
            "color": 4,
            "width": 680,
            "height": 220,
            "content": "## Slots Available Acknowledgement"
          },
          "typeVersion": 1
        },
        {
          "id": "c4178143-fa14-4d25-b477-c12eefd442c2",
          "name": "Sticky Note11",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1560,
            280
          ],
          "parameters": {
            "color": 4,
            "width": 180,
            "height": 280,
            "content": "## IF Error Exists"
          },
          "typeVersion": 1
        },
        {
          "id": "cf70e686-21cd-48ff-a086-c17a5bf66987",
          "name": "ISO 8601 Formatter",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            940,
            380
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "role": "system",
                  "content": "You are a time formatting system that converts natural language time expressions into ISO 8601 date/time formats. Your task is to:\n\n1. Parse the natural language time provided.\n2. Calculate the `startTime` in ISO 8601 format, using the Eastern Time Zone.\n\n### Input Details:\nYou will receive JSON input with the following fields:\n- `currentTime`: The current date and time in ISO 8601 format (e.g., \"2025-01-20T12:00:00-05:00\").\n- `naturalLanguageTime`: A natural language time expression (e.g., \"tomorrow at 2PM\").\n\n### Output Format:\nReturn your result as JSON with the following structure:\n```json\n{\n  \"startTime\": \"<ISO 8601 start time>\"\n}\n\n### Example input:\n{\n  \"currentTime\": \"2025-01-20T12:00:00-05:00\",\n  \"naturalLanguageTime\": \"tomorrow at 2PM\"\n}\n\n### Example output:\n{\n  \"startTime\": \"2025-01-21T14:00:00-05:00\"\n}\n"
                },
                {
                  "content": "={“currentTime”: “{{$now}}”, “naturalLanguageTime”: “{{ $('Switch').item.json.body.args.requested_appointment }}”}"
                }
              ]
            },
            "jsonOutput": true
          },
          "credentials": {
            "openAiApi": {
              "id": "YOUR_OPENAI_CREDENTIAL_ID",
              "name": "OpenAI account"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "ed5ae816-dc2a-477e-b68a-830854602ec4",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            1600,
            380
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "f5771fd6-8477-4941-aaba-39211350725d",
                  "operator": {
                    "type": "number",
                    "operation": "exists",
                    "singleValue": true
                  },
                  "leftValue": "={{ $json.error.status }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "749b6e35-e976-417f-bb8d-fe025bcc83a2",
          "name": "Get Available Slots",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2420,
            160
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/calendars/{{ $('For Call').item.json.calendarId }}/free-slots",
            "options": {},
            "sendQuery": true,
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "queryParameters": {
              "parameters": [
                {
                  "name": "=startDate",
                  "value": "={{ $('Start Date').item.json.startDate }}"
                },
                {
                  "name": "endDate",
                  "value": "={{ $json.endDate }}"
                }
              ]
            },
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-04-15"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "d1e45b50-bb27-4ee9-b782-2b5eb20ea9c7",
          "name": "Open Slots",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            2860,
            160
          ],
          "parameters": {
            "options": {},
            "respondWith": "json",
            "responseBody": "={\n  \"result\": \"That slot is not available. Here are some open slots: {{ $json[\"2025-10-03\"].slots }}, {{ $json[\"2025-10-06\"].slots }}\"\n}"
          },
          "typeVersion": 1.1
        },
        {
          "id": "fca0bd57-217e-4c81-a53a-77665cd58198",
          "name": "set contact id",
          "type": "n8n-nodes-base.set",
          "position": [
            180,
            880
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "2eca4e3a-831d-400e-85e7-94cb36c74ad2",
                  "name": "contactId",
                  "type": "string",
                  "value": "={{$json.contact.id}}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "55ee47fb-d6a9-42be-a4c7-7bb6a0b71688",
          "name": "Successful Booking",
          "type": "n8n-nodes-base.respondToWebhook",
          "position": [
            2860,
            400
          ],
          "parameters": {
            "options": {},
            "respondWith": "json",
            "responseBody": "={\n  \"result\": \"I've booked your appointment for {{ $('ISO 8601 Formatter').item.json.message.content.startTime }}\"\n}"
          },
          "typeVersion": 1.2
        },
        {
          "id": "aeb59d98-7a25-4725-bded-1c6edd1ef068",
          "name": "Data Preprocessing",
          "type": "n8n-nodes-base.code",
          "position": [
            1920,
            660
          ],
          "parameters": {
            "jsCode": "// Function to perform the full cleaning (kept for context)\nconst fullCleanup = (text) => {\n    if (typeof text !== 'string') {\n        return '';\n    }\n    // Regexes (kept for context)\n    const CLEANUP_REGEX = /(\\r\\n|\\n|\\r|\\\\n)/gm;\n    const MULTI_SPACE_REGEX = /\\s\\s+/g;\n\n    // 1. Replace all newlines (and escaped newlines) with a single space\n    let cleanedText = text.replace(CLEANUP_REGEX, ' ');\n    // 2. Replace all multiple spaces (including new spaces from step 1) with a single space\n    cleanedText = cleanedText.replace(MULTI_SPACE_REGEX, ' ');\n    // 3. Trim any leading/trailing spaces\n    return cleanedText.trim();\n};\n\nconst output = [];\n\nfor (const item of $input.all()) {\n    const json = item.json;\n\n    // --- 1. Safely extract and clean Transcript ---\n    let rawTranscript = '';\n    try {\n        rawTranscript = json.body.call.transcript;\n    } catch (e) {\n        rawTranscript = '';\n    }\n    const cleanedTranscript = fullCleanup(rawTranscript); // Apply the function\n\n    // --- 2. Format Duration (from milliseconds to HH:MM:SS) ---\n    let formattedDuration = '00:00:00';\n    try {\n        const durationMs = json.body.call.duration_ms;\n        if (typeof durationMs === 'number' && durationMs > 0) {\n            formattedDuration = new Date(durationMs).toISOString().substr(11, 8);\n        }\n    } catch (e) {\n        // formattedDuration remains '00:00:00' on error\n    }\n\n    // --- 3. Safely get and Clean other required values ---\n\n    // Appointment Status - CORRECTED LOGIC\n    let appointmentStatus = 'undefined';\n    try {\n        // Correct path to appointment_info within the current 'json' item\n        const appointmentInfo = json.body.call.call_analysis.custom_analysis_data.appointment_info;\n        if (appointmentInfo !== null && appointmentInfo !== undefined) {\n            // Convert to string, assuming it's a simple value (like a status string or boolean)\n            appointmentStatus = String(appointmentInfo);\n        }\n    } catch (e) {\n        // If any part of the path is null/undefined, it defaults to 'undefined' set above\n    }\n\n    // Recording URL and Disconnection Reason\n    const recordingUrl = json.body?.call?.recording_url || '';\n    const disconnectionReason = json.body?.call?.disconnection_reason || '';\n\n    // Detailed Call Summary - Extract and Clean\n    let rawDetailedCallSummary = '';\n    try {\n        rawDetailedCallSummary = json.body.call.call_analysis.custom_analysis_data.detailed_call_summary;\n    } catch (e) {\n        rawDetailedCallSummary = '';\n    }\n    const cleanedDetailedCallSummary = fullCleanup(rawDetailedCallSummary); // Apply the function\n\n    // NEW: Safely get User Sentiment\n    let userSentiment = '';\n    try {\n        userSentiment = json.body.call.call_analysis.user_sentiment || '';\n    } catch (e) {\n        userSentiment = '';\n    }\n\n    // --- 4. Prepare the Final Output Structure ---\n    output.push({\n        json: {\n            customFields: [\n                {\n                    \"id\": \"nWM7SzcOoEl4PCfymWe3\",\n                    \"field_value\": cleanedTranscript\n                },\n                {\n                    \"id\": \"01gG4gsZCm4le2h3pTFw\",\n                    \"field_value\": formattedDuration\n                },\n                {\n                    \"id\": \"PsG0LQ8mWOe7JqDJivHA\",\n                    \"field_value\": appointmentStatus // Now correctly set\n                },\n                {\n                    \"id\": \"iTFD8OLVnFIWSezWhU2c\",\n                    \"field_value\": recordingUrl\n                },\n                {\n                    \"id\": \"UBDsU3VRZ4mKFJL5B825\",\n                    \"field_value\": disconnectionReason\n                },\n                {\n                    \"id\": \"W5ptzXN5tbvWMvtWYBWw\",\n                    \"field_value\": cleanedDetailedCallSummary\n                },\n                {\n                    \"id\": \"S3wk0EcfzUalMBVwYslL\",\n                    \"field_value\": userSentiment\n                }\n            ]\n        }\n    });\n}\n\nreturn output;"
          },
          "typeVersion": 2
        },
        {
          "id": "0d37cfef-e263-47b1-b8f0-7018066e275a",
          "name": "Call Answered",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            1140
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"answered\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "4990a588-67d5-4154-b35b-510322056c1f",
          "name": "Not Connected",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            1480
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"call did not connect\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "984c2753-a8a7-480f-9d30-601798c83f27",
          "name": "Not Answered",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            1300
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"dna\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "50d7d0c4-e635-4f70-8f20-0a54479b7bf0",
          "name": "Don't Contact",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            1660
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"dnc\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "f1def970-b24c-4dcb-9624-1cf6ea5187c1",
          "name": "Call Transfer",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            1840
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"answered\",\"call transfer\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "1deb181a-8e4b-4cff-9692-9f4e0911b7ef",
          "name": "Add Tags",
          "type": "n8n-nodes-base.switch",
          "position": [
            1920,
            1260
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "outputKey": "Answered",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "5a8db980-8e40-4db2-bd33-a3306a405b72",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "agent_hangup"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Answered",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "4adc20cf-b400-499a-bd04-ae1a56e977a5",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "user_hangup"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "Answered",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "9e4fb1ba-d907-4618-8b65-77510b45b8ec",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "max_duration_reached"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNA",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "9bf7771b-6d36-49ff-bd1d-1a9cd731cdf2",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "voicemail_reached"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNA",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "7a2515fb-7486-49df-86e9-822b2ccebabd",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "dial_no_answer"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNA",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "a3ba8579-f5bb-48bb-8886-afd13aea00d2",
                        "operator": {
                          "type": "string",
                          "operation": "empty",
                          "singleValue": true
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": ""
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "NOT CONNECTED",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "d30bc172-ce0a-4bb5-99be-595459a018c8",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "dial_busy"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "NOT CONNECTED",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "e4a73b39-f869-475b-bae7-2f8f062f28af",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "dial_failed"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNC",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "a3b4ffa3-4225-4ed2-92b1-fe0f24b5393f",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "invalid_destination"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNC",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "25e0bfec-f228-412e-9a45-42401c1ffc55",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "marked_as_spam"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "DNC",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "2632fd07-9c2d-4f7a-8d2b-535e42acad63",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "scam_detected"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "outputKey": "CALL TRANSFER",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "ef49b752-85a9-48fc-ba20-0ad1ed683e5b",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                        "rightValue": "call_transfer"
                      }
                    ]
                  },
                  "renameOutput": true
                },
                {
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "7f18b90f-9cb6-4de1-b48f-85320d968d1d",
                        "operator": {
                          "name": "filter.operator.equals",
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "",
                        "rightValue": ""
                      }
                    ]
                  }
                }
              ]
            },
            "options": {
              "ignoreCase": false
            }
          },
          "typeVersion": 3.2
        },
        {
          "id": "dd928d1f-bc83-47a5-bcd7-3267791ae943",
          "name": "Sticky Note12",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1760,
            940
          ],
          "parameters": {
            "color": 5,
            "width": 1740,
            "height": 1040,
            "content": "## Adding Tags to contacts"
          },
          "typeVersion": 1
        },
        {
          "id": "1e602a3f-65db-4c07-bdb7-38173bc985da",
          "name": "Error Handling",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2640,
            960
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"error\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "456cb72a-0fc3-4c92-ba73-c059e4d864a9",
          "name": "If Error Detected",
          "type": "n8n-nodes-base.if",
          "position": [
            1920,
            980
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "or",
              "conditions": [
                {
                  "id": "51608558-7b36-49b9-a712-75c80770e57d",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].id }}",
                  "rightValue": "concurrency_limit_reached"
                },
                {
                  "id": "39aa5a8b-f9b6-45ba-97c2-a61d1980f1f4",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                  "rightValue": "error_no_audio_received"
                },
                {
                  "id": "685e4520-922b-4738-9a7e-61d69cc3849f",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                  "rightValue": "error_asr"
                },
                {
                  "id": "7e264d68-6689-4a37-a831-9d69abc009c8",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                  "rightValue": "error_retell"
                },
                {
                  "id": "1cf82471-fd0b-4ab7-9e67-c2fc43b0785b",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                  "rightValue": "error_unknown"
                },
                {
                  "id": "44d9ff65-b856-4b26-afdb-4ebd6e1f00a7",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Data Preprocessing').item.json.customFields[4].field_value }}",
                  "rightValue": "registered_call_timeout"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "50c34f3e-48f4-47d0-9774-51ff6c0cb769",
          "name": "Appointment Confirmed",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            1400
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"appointment confirmed\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "fba3832b-0a4a-4567-a2bb-6dce348f116d",
          "name": "IF Confirmed",
          "type": "n8n-nodes-base.if",
          "position": [
            2960,
            1320
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "30d959e7-9788-4174-9e0a-75579087f3ae",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Webhook').item.json.body.call.call_analysis.custom_analysis_data.appointment_info }}",
                  "rightValue": "Success"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "08e01544-f436-4c44-9ad6-d66822414871",
          "name": "Inbound Call",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            880,
            1000
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $json.contactId }}/tags",
            "body": "={\n  \"tags\": [\"inbound call\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "d7fcea87-b404-485c-8377-cc7cb29cdc3c",
          "name": "Sticky Note14",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            660,
            860
          ],
          "parameters": {
            "color": 5,
            "width": 400,
            "height": 400,
            "content": "## Inbound Tagging"
          },
          "typeVersion": 1
        },
        {
          "id": "28f5282b-1eb7-48c1-94b2-4cabe96fdae3",
          "name": "Edit Fields",
          "type": "n8n-nodes-base.set",
          "position": [
            700,
            1000
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "3deb5683-0f79-4738-87f8-624f42d1a98a",
                  "name": "contactId",
                  "type": "string",
                  "value": "={{ $json.contactId }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "d4ca6c42-0a47-4cc4-9f3b-1066878a73a7",
          "name": "Handle Error",
          "type": "n8n-nodes-base.set",
          "position": [
            180,
            1120
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "b22b42ea-9830-46f2-96bf-d43d8028c7f8",
                  "name": "contactId",
                  "type": "string",
                  "value": "={{$json.error.message.match(/[\\\\]?\"contactId[\\\\]?\":\\s*[\\\\]?\"([^\"\\\\]+)[\\\\]?\"/)?.[1]}}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "e241c32c-da0e-4f1f-b553-18b9474c3e05",
          "name": "Successful Booking to GHL",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            400
          ],
          "parameters": {
            "url": "https://services.leadconnectorhq.com/hooks/7CXSHcISS8H6LYDZWiva/webhook-trigger/ab217252-5ac4-4c52-8cf6-bcf00aafa64a",
            "body": "={\n        \"contactId\": \"{{ $('Webhook').item.json.body.chat.retell_llm_dynamic_variables.contactId }}\",\n        \"content\": \"Great! Your Appointment is successfully booked for {{ $json.message.content.humanFriendly }}\"\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "rawContentType": "application/json"
          },
          "typeVersion": 4.2
        },
        {
          "id": "d196a7dd-faf2-46ea-95ad-3bf39dfd12eb",
          "name": "Human Friendly Time Formatter",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            3040,
            400
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "role": "system",
                  "content": "You are a time formatting system that converts **ISO FORMAT TO HUMAN FRIENDLY**  natural language time expressions date/time formats.\n"
                },
                {
                  "content": "={“currentTime”: “{{$now}}”, “ISO FORMATE”: “{{ $('ISO 8601 Formatter').item.json.message.content.startTime }}”}"
                }
              ]
            },
            "jsonOutput": true
          },
          "credentials": {
            "openAiApi": {
              "id": "YOUR_OPENAI_CREDENTIAL_ID",
              "name": "OpenAI account"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "679630a3-ddb0-407c-9556-d4945249863a",
          "name": "Successful Booking to GHL1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            160
          ],
          "parameters": {
            "url": "https://services.leadconnectorhq.com/hooks/7CXSHcISS8H6LYDZWiva/webhook-trigger/ab217252-5ac4-4c52-8cf6-bcf00aafa64a",
            "body": "={\n        \"contactId\": \"{{ $('Webhook').item.json.body.chat.retell_llm_dynamic_variables.contactId }}\",\n        \"content\": \"That slot is not available. {{ $json.message.content.replace(/\\n/g, '') }}\"\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "rawContentType": "application/json"
          },
          "typeVersion": 4.2
        },
        {
          "id": "38514a96-da16-40bd-bde6-0dcb067d4273",
          "name": "Human Friendly Time Formatter1",
          "type": "@n8n/n8n-nodes-langchain.openAi",
          "position": [
            3040,
            160
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o",
              "cachedResultName": "GPT-4O"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "role": "system",
                  "content": "You are a time formatting system that converts **ISO FORMAT TO HUMAN FRIENDLY**  natural language time expressions date/time formats.\n\nresponse:\nHere are the avaIlable slots :\n[slots]\n\n\n"
                },
                {
                  "content": "={“currentTime”: “{{$now}}”, “ISO FORMATE”: “{{ $json[\"2025-10-03\"].slots }} {{ $json[\"2025-10-06\"].slots }}, ”}"
                }
              ]
            }
          },
          "credentials": {
            "openAiApi": {
              "id": "YOUR_OPENAI_CREDENTIAL_ID",
              "name": "OpenAI account"
            }
          },
          "typeVersion": 1.8
        },
        {
          "id": "72e84b7e-3108-4887-bdd4-a6e72b701bb6",
          "name": "Webhook2",
          "type": "n8n-nodes-base.webhook",
          "position": [
            -60,
            1620
          ],
          "webhookId": "eeb11d3c-edc6-4202-aaf5-1f5fca45d729",
          "parameters": {
            "path": "eeb11d3c-edc6-4202-aaf5-1f5fca45d729",
            "options": {},
            "httpMethod": "POST",
            "responseMode": "lastNode"
          },
          "typeVersion": 2
        },
        {
          "id": "9d2d8626-7246-4425-b401-2002375b8c09",
          "name": "HTTP Request4",
          "type": "n8n-nodes-base.httpRequest",
          "onError": "continueRegularOutput",
          "position": [
            160,
            1620
          ],
          "parameters": {
            "url": "=https://api.retellai.com/get-chat/{{ $json.body.Chat_Id }}",
            "options": {},
            "sendHeaders": true,
            "headerParameters": {
              "parameters": [
                {
                  "name": "Authorization",
                  "value": "Bearer YOUR_BEARER_TOKEN"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "1182931e-5bf2-4dde-8316-46f21b1a8392",
          "name": "HTTP Request5",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1220,
            1620
          ],
          "parameters": {
            "url": "=https://api.retellai.com/create-chat-completion",
            "body": "={\n  \"chat_id\": \"{{ $json.chat_id }}\",\n  \"content\": \"{{ $('Webhook2').item.json.body.message }}\"\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "rawContentType": "application/json",
            "headerParameters": {
              "parameters": [
                {
                  "name": "content-type",
                  "value": "application/json"
                },
                {
                  "name": "Authorization",
                  "value": "Bearer YOUR_BEARER_TOKEN"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "c4c70797-d9ce-40da-ad26-9275c89a1f66",
          "name": "Chat Id Input2",
          "type": "n8n-nodes-base.set",
          "position": [
            1040,
            1480
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "46fab7f9-c97b-4af5-8995-54351fd7d9f6",
                  "name": "chat_id",
                  "type": "string",
                  "value": "={{ $('Create Chat Session').item.json.chat_id }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "b227ce51-70e5-4763-849c-727c3f3d9964",
          "name": "Chat Id Input3",
          "type": "n8n-nodes-base.set",
          "position": [
            800,
            1780
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "dc21a006-396e-48a5-b016-ada9ad9c5cdb",
                  "name": "chat_id",
                  "type": "string",
                  "value": "={{ $json.chat_id }}"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "700ec44c-f9be-45b4-b1ed-4143a0745148",
          "name": "Sticky Note15",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -100,
            1400
          ],
          "parameters": {
            "color": 2,
            "width": 1840,
            "height": 580,
            "content": "## AI Chat Agent"
          },
          "typeVersion": 1
        },
        {
          "id": "123e1cdf-f555-470e-bc55-1d62e1b0e150",
          "name": "If chat session Exists1",
          "type": "n8n-nodes-base.if",
          "position": [
            380,
            1620
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "474062df-e43e-4fe4-a399-4864969b9da1",
                  "operator": {
                    "type": "number",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.error.status }}",
                  "rightValue": 404
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "7552e5a4-0c09-45da-8a29-7854d2e2f07c",
          "name": "Creat Chat Id GHL1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            800,
            1480
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook2').item.json.body.contactId }}",
            "body": "={\n  \"customFields\": [\n    {\n      \"id\": \"Rq0WysYjIpwoDxQ6gzxI\",\n      \"value\": \"{{ $json.chat_id }}\"\n    }\n  ]\n}",
            "method": "PUT",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "e1422695-be49-4902-b011-1ce38cf5cdda",
          "name": "Respond to GHL1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1520,
            1620
          ],
          "parameters": {
            "url": "https://services.leadconnectorhq.com/hooks/7CXSHcISS8H6LYDZWiva/webhook-trigger/ab217252-5ac4-4c52-8cf6-bcf00aafa64a",
            "body": "={\n        \"contactId\": \"{{ $('Webhook2').item.json.body.contactId }}\",\n        \"role\": \"{{ $json.messages[0].role }}\",\n        \"created_timestamp\": \"{{ $json.messages[0].created_timestamp }}\",\n        \"content\": \"{{ $json.messages[0].content.replace(/\\n/g, ' ') }}\"\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "rawContentType": "application/json"
          },
          "typeVersion": 4.2
        },
        {
          "id": "aaabfa2d-ef85-4286-8256-02c274a54d66",
          "name": "Add Sentiment",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            1240
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"{{ $('Webhook').item.json.body.call.call_analysis.user_sentiment }}\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "3bb59f99-be4e-4188-b5a6-085aa5baa5fa",
          "name": "HTTP Request1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3280,
            2060
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/locations/7CXSHcISS8H6LYDZWiva/tags",
            "options": {},
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "ca0c7590-3d5b-420c-b24b-df89def3c10a",
          "name": "If1",
          "type": "n8n-nodes-base.if",
          "position": [
            2960,
            1060
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "1e50f115-5142-492d-80c6-458c3028e258",
                  "operator": {
                    "type": "boolean",
                    "operation": "true",
                    "singleValue": true
                  },
                  "leftValue": "={{ $('Webhook').item.json.body.call.call_analysis.custom_analysis_data.dnc }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "e7950daa-84d0-401f-877e-1f3626652223",
          "name": "dnc",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            1080
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "body": "={\n  \"tags\": [\"dnc\"]\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "783ac889-7f4e-4099-b5f2-4d1a55d7615d",
          "name": "Switching Request Type",
          "type": "n8n-nodes-base.if",
          "position": [
            520,
            360
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "01681a71-0c15-4109-8b17-7e549f5143c5",
                  "operator": {
                    "type": "string",
                    "operation": "exists",
                    "singleValue": true
                  },
                  "leftValue": "={{ $json.body.call.retell_llm_dynamic_variables.contactId }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "63f8325a-7c82-4fab-a171-a53fe86df593",
          "name": "For Call",
          "type": "n8n-nodes-base.set",
          "position": [
            760,
            280
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a3b74554-5ef7-4fcf-a5ad-8f8146b1095b",
                  "name": "locationId",
                  "type": "string",
                  "value": "7CXSHcISS8H6LYDZWiva"
                },
                {
                  "id": "067723ad-1518-48dd-a60a-85b6d4aff62a",
                  "name": "contactId",
                  "type": "string",
                  "value": "={{ $json.body.call.retell_llm_dynamic_variables.contactId }}"
                },
                {
                  "id": "ceca4d68-e3bf-4f3d-bdb5-9539118104af",
                  "name": "calendarId",
                  "type": "string",
                  "value": "sYe6ePU9xf6TSphIEG8W"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "d0e679ce-4b92-4466-9b39-416c8e5fbe60",
          "name": "For Chat",
          "type": "n8n-nodes-base.set",
          "position": [
            760,
            440
          ],
          "parameters": {
            "options": {},
            "assignments": {
              "assignments": [
                {
                  "id": "a3b74554-5ef7-4fcf-a5ad-8f8146b1095b",
                  "name": "locationId",
                  "type": "string",
                  "value": "7CXSHcISS8H6LYDZWiva"
                },
                {
                  "id": "067723ad-1518-48dd-a60a-85b6d4aff62a",
                  "name": "contactId",
                  "type": "string",
                  "value": "={{ $json.body.chat.retell_llm_dynamic_variables.contactId }}"
                },
                {
                  "id": "ceca4d68-e3bf-4f3d-bdb5-9539118104af",
                  "name": "calendarId",
                  "type": "string",
                  "value": "sYe6ePU9xf6TSphIEG8W"
                }
              ]
            }
          },
          "typeVersion": 3.4
        },
        {
          "id": "a6d14bd3-e0df-4484-ac09-4f7b65caeb8d",
          "name": "Sticky Note13",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            460,
            280
          ],
          "parameters": {
            "color": 2,
            "height": 280,
            "content": "## Selecting Agent"
          },
          "typeVersion": 1
        },
        {
          "id": "87c4a4da-0dcb-4c0b-9d12-7e204b1be253",
          "name": "Create Chat Session",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            560,
            1480
          ],
          "parameters": {
            "url": "https://api.retellai.com/create-chat",
            "body": "={\n  \"agent_id\": \"agent_f3a68dc60637485d5851053040\",\n  \"retell_llm_dynamic_variables\": {\n    \"customer_name\": \"{{ $('Webhook2').item.json.body.customer_name }}\",\n    \"contactId\": \"{{ $('Webhook2').item.json.body.contactId }}\",\n    \"pain_point\": \"{{ $('Webhook2').item.json.body.pain_point }}\",\n    \"email\": \"{{ $('Webhook2').item.json.body.email }}\"\n  }\n}",
            "method": "POST",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "rawContentType": "application/json",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Authorization",
                  "value": "Bearer YOUR_BEARER_TOKEN"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "646e38d3-64c9-4a83-8ae8-3c19c5fea30a",
          "name": "Update Custom Fields",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            2160,
            660
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}",
            "body": "={\n  \"customFields\": [\n    {\n      \"id\": \"nWM7SzcOoEl4PCfymWe3\",\n      \"value\": \"{{ $json.customFields[0].field_value }}\"\n    },\n    {\n      \"id\": \"01gG4gsZCm4le2h3pTFw\", \n      \"value\": \"{{ $json.customFields[1].field_value }}\"\n    },\n    {\n      \"id\": \"PsG0LQ8mWOe7JqDJivHA\",\n      \"value\": \"{{ $json.customFields[2].field_value }}\"\n    },\n    {\n      \"id\": \"iTFD8OLVnFIWSezWhU2c\",\n      \"value\": \"{{ $json.customFields[3].field_value }}\"\n    },\n    {\n      \"id\": \"UBDsU3VRZ4mKFJL5B825\",\n      \"value\": \"{{ $json.customFields[4].field_value }}\"\n    },\n    {\n      \"id\": \"W5ptzXN5tbvWMvtWYBWw\",\n      \"value\": \"{{ $json.customFields[5].field_value }}\"\n      \n    },\n    {\n      \"id\": \"Cugyhex6AU7WJkpk4SSa\",\n      \"value\": \"{{ $json.customFields[6].field_value }}\"\n    }\n  ]\n}",
            "method": "PUT",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "7cfb8d77-afec-4fce-b7b1-737fff18640f",
          "name": "Update Details",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            640
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}",
            "body": "={\n  \"firstName\": \"{{ $json.firstName }}\",\n  \"lastName\": \"{{ $json.lastName }}\",\n  \"email\": \"{{ $('Webhook').item.json.body.call.call_analysis.custom_analysis_data.customer_email }}\"\n}",
            "method": "PUT",
            "options": {},
            "sendBody": true,
            "contentType": "raw",
            "sendHeaders": true,
            "authentication": "genericCredentialType",
            "rawContentType": "application/json",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "edc88946-c151-450d-a75f-87bc9ccec2b7",
          "name": "Sticky Note17",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            2820,
            600
          ],
          "parameters": {
            "color": 3,
            "width": 680,
            "height": 240,
            "content": "## Update Customer Details"
          },
          "typeVersion": 1
        },
        {
          "id": "c009fc08-adce-47f2-8000-31e6b54a57e5",
          "name": "Name Extractor",
          "type": "n8n-nodes-base.code",
          "position": [
            2860,
            660
          ],
          "parameters": {
            "jsCode": "const fullName = $('Webhook').first().json.body.call.call_analysis.custom_analysis_data.customer_name || \"\";\n\nconst match = fullName.match(/^(\\S+)(?:\\s+(.*))?$/);\n\nconst firstName = match ? match[1] : \"\";\nconst lastName = match && match[2] ? match[2] : \"\";\n\nreturn [\n  {\n    json: {\n      firstName,\n      lastName\n    }\n  }\n];\n"
          },
          "typeVersion": 2
        },
        {
          "id": "27009911-0655-49ed-b298-7d03ba358260",
          "name": "IF Data Exists",
          "type": "n8n-nodes-base.if",
          "position": [
            3040,
            660
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "or",
              "conditions": [
                {
                  "id": "7b4182be-edd2-4e17-89ed-2608ae663381",
                  "operator": {
                    "type": "string",
                    "operation": "notEmpty",
                    "singleValue": true
                  },
                  "leftValue": "={{ $('Webhook').item.json.body.call.call_analysis.custom_analysis_data.customer_email }}",
                  "rightValue": ""
                },
                {
                  "id": "02a83873-3d56-4d31-8da6-9bcee0bbabc1",
                  "operator": {
                    "type": "string",
                    "operation": "notEmpty",
                    "singleValue": true
                  },
                  "leftValue": "={{ $('Webhook').item.json.body.call.call_analysis.custom_analysis_data.customer_email }}",
                  "rightValue": ""
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "0a25595a-6ead-4916-81bb-4bc65daa4ec2",
          "name": "If2",
          "type": "n8n-nodes-base.if",
          "position": [
            2960,
            940
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "1e50f115-5142-492d-80c6-458c3028e258",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Webhook').item.json.body.call.agent_name }}",
                  "rightValue": "SMMA Bot - Inbound"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "2cc4048c-b830-4805-9372-9f34cbc0e2b4",
          "name": "remove tag",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            3340,
            940
          ],
          "parameters": {
            "url": "=https://services.leadconnectorhq.com/contacts/{{ $('Webhook').item.json.body.call.retell_llm_dynamic_variables.contactId }}/tags",
            "method": "DELETE",
            "options": {},
            "jsonBody": "{\n  \"tags\": [\"answered\"]\n}",
            "sendBody": true,
            "sendHeaders": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "headerParameters": {
              "parameters": [
                {
                  "name": "Version",
                  "value": "2021-07-28"
                },
                {
                  "name": "content-type",
                  "value": "application/json"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "ad454caf-6494-4022-b816-ece49df83657",
          "name": "OpenAI Chat Model2",
          "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
          "position": [
            1960,
            -80
          ],
          "parameters": {
            "model": {
              "__rl": true,
              "mode": "list",
              "value": "gpt-4o-mini"
            },
            "options": {}
          },
          "credentials": {
            "openAiApi": {
              "id": "YOUR_OPENAI_CREDENTIAL_ID",
              "name": "OpenAI account"
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "1cb177b1-3ca4-4b3e-9767-f1926ae8450d",
          "name": "Call report",
          "type": "@n8n/n8n-nodes-langchain.chainLlm",
          "position": [
            1320,
            -280
          ],
          "parameters": {
            "text": "=<system_prompt>\nYOU ARE AN EXPERT CALL ANALYST AGENT TRAINED TO GENERATE STRUCTURED CALL REPORTS FROM RAW TRANSCRIPTS. YOUR OUTPUT MUST ALWAYS FOLLOW THE EXACT REPORT FORMAT PROVIDED BELOW.\n\nTranscript: {{ $json.body.call.transcript }}\nPhone Number: {{ $json.body.call.to_number }}\nDuration: {{ $json.body.call.duration_ms }}\nName: {{ $json.body.call.retell_llm_dynamic_variables.customer_name }}{{ $json.body.call.call_analysis.custom_analysis_data.customer_name }} (if not provided leave it blank)\nEmail: {{ $json.body.call.retell_llm_dynamic_variables.email }}{{ $json.body.call.call_analysis.custom_analysis_data.customer_email }} (if not provided leave it blank)\nCall Sentiment: {{ $('Switch').item.json.body.call.call_analysis.user_sentiment }}\n\n### INSTRUCTIONS ###\n\n- YOU MUST READ the entire call transcript carefully\n- YOU MUST EXTRACT the following details:\n  1. CALL REPORT HEADER → Always display as: \"CALL REPORT\"\n  2. NAME → Extract user’s name if available, else leave blank\n  3. EMAIL → Extract user’s email if available, else leave blank\n  4. SENTIMENT → Use the provided sentiment classification (Positive, Neutral, or Negative)\n  5. USER PHONE NUMBER → Output in format \"+1XXXXXXXXXX\"\n  6. SUCCESS SCORE → Assign a value between 0/10 based on whether the call goals were met\n  7. SATISFACTION SCORE → Assign a value between 0/10 based on user’s tone, language, and overall interaction\n  8. STATUS → Classify as \"Complete\" if the call achieved its purpose, or \"Incomplete\" otherwise\n  9. CALL DURATION → Convert provided duration (ms) into minutes with one decimal place\n\n- OUTPUT MUST BE STRUCTURED EXACTLY IN THIS FORMAT (NO EXTRA TEXT):\n\n  CALL REPORT\n  Name: [Name or blank]\n  Email: [Email or blank]\n  Sentiment: [Positive / Neutral / Negative]\n  Phone Number ● +1XXXXXXXXXX\n  Success X/10 ● Satisfaction X/10 ● [Complete/Incomplete]\n  Call Duration: X.X Minutes\n\n### CHAIN OF THOUGHTS ###\n\n1. UNDERSTAND the transcript and determine call context  \n2. IDENTIFY the caller’s name, email, and phone number  \n3. INCLUDE sentiment from the provided metadata  \n4. BREAK DOWN the conversation into intent, progress, and resolution  \n5. ANALYZE user’s tone and engagement to score Satisfaction (0–10)  \n6. ASSESS completion of the call’s purpose to score Success (0–10) and mark status (Complete/Incomplete)  \n7. CALCULATE call duration from milliseconds into minutes (1 decimal)  \n8. PRESENT the structured report in the required format  \n\n### WHAT NOT TO DO ###\n\n- NEVER ADD extra commentary, explanations, or labels outside the report format  \n- NEVER OMIT sentiment (must always show Positive, Neutral, or Negative)  \n- NEVER OUTPUT anything other than the structured report  \n- NEVER USE placeholders like \"N/A\" or \"Unknown\" — leave blank if data missing  \n- NEVER FORMAT phone numbers incorrectly (must be +1XXXXXXXXXX)  \n- NEVER WRITE long paragraphs or summaries in the output  \n\n### FEW-SHOT EXAMPLES ###\n\n**Example Input (Transcript):**\n\"Caller: Hi, I’m calling about my Agency Strategy.  \nAgent: Sure, let me confirm your appointment.  \nCaller: Yes, it’s tomorrow at 10, right?  \nAgent: Correct. Thank you for confirming.  \n[Call ended, duration ~2.4 min]  \nPhone: +17739935718\"\n\n**Example Output:**\nCALL REPORT\nName: michael\nEmail: user@example.com\nSentiment: Neutral\nPhone Number ● +17739935718\nSuccess 5/10 ● Satisfaction 5/10 ● Incomplete\nCall Duration: 2.4 Minutes\n</system_prompt>\n",
            "promptType": "define",
            "hasOutputParser": true
          },
          "typeVersion": 1.6
        },
        {
          "id": "8bcbd3f9-9ca6-4ed1-8d60-e341a76e0d4c",
          "name": "Sticky Note19",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            940,
            -480
          ],
          "parameters": {
            "color": 6,
            "width": 2560,
            "height": 560,
            "content": "## Post Call Slack Notification"
          },
          "typeVersion": 1
        },
        {
          "id": "8c8365ed-38db-4ff2-8ab2-a0bcce2aa03e",
          "name": "If Negative Sentiment2",
          "type": "n8n-nodes-base.if",
          "position": [
            1980,
            -280
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "or",
              "conditions": [
                {
                  "id": "63c4c0e1-8e65-4f54-b457-df53f14c961f",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Switch').item.json.body.call.call_analysis.user_sentiment }}",
                  "rightValue": "Negative"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "be922fb4-416c-407d-93ce-aabf601bb54d",
          "name": "If Negative Sentiment3",
          "type": "n8n-nodes-base.if",
          "position": [
            2900,
            -260
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "or",
              "conditions": [
                {
                  "id": "63c4c0e1-8e65-4f54-b457-df53f14c961f",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $('Switch').item.json.body.call.call_analysis.user_sentiment }}",
                  "rightValue": "Negative"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "6575fd7e-7a83-4226-bcd6-c0ce421974ab",
          "name": "If Phone Call",
          "type": "n8n-nodes-base.if",
          "position": [
            1080,
            -280
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "loose"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "7b2c21cf-2682-42f0-beab-7031b6615ce0",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.body.event }}",
                  "rightValue": "call_analyzed"
                },
                {
                  "id": "59037e7f-6043-4d1f-94d3-bac9dd0bf3a9",
                  "operator": {
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.body.call.call_type }}",
                  "rightValue": "phone_call"
                },
                {
                  "id": "81846021-4df8-4e38-8b24-b11e515ba052",
                  "operator": {
                    "type": "number",
                    "operation": "gte"
                  },
                  "leftValue": "={{ $json.body.call.duration_ms }}",
                  "rightValue": 10000
                }
              ]
            },
            "looseTypeValidation": true
          },
          "typeVersion": 2.2
        },
        {
          "id": "130cf235-142b-4255-ae30-69faf67ca53b",
          "name": "Negative Calls",
          "type": "n8n-nodes-base.slack",
          "position": [
            3240,
            -400
          ],
          "webhookId": "5ea0aa02-f03e-44be-9bf3-6136e6a35b73",
          "parameters": {
            "text": "={{ $json.text }}",
            "select": "channel",
            "channelId": {
              "__rl": true,
              "mode": "list",
              "value": "C09JC2JLNTW",
              "cachedResultName": "sales-ai-negative-calls"
            },
            "otherOptions": {
              "thread_ts": {
                "replyValues": {
                  "thread_ts": "={{ $('-ive Calls Report Creation').item.json.message_timestamp }}"
                }
              }
            }
          },
          "credentials": {
            "slackApi": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "3a498600-3b91-4166-8659-18f856ff7097",
          "name": "All Calls",
          "type": "n8n-nodes-base.slack",
          "position": [
            3240,
            -140
          ],
          "webhookId": "5ea0aa02-f03e-44be-9bf3-6136e6a35b73",
          "parameters": {
            "text": "={{ $('Structured Transcript Summary').item.json.text }}",
            "select": "channel",
            "channelId": {
              "__rl": true,
              "mode": "list",
              "value": "C09J6ABP9ML",
              "cachedResultName": "sales-ai-all-calls"
            },
            "otherOptions": {
              "thread_ts": {
                "replyValues": {
                  "thread_ts": "={{ $('All Calls Report Creation').item.json.message_timestamp }}"
                }
              }
            }
          },
          "credentials": {
            "slackApi": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "8a350362-bda5-4fe7-ab7b-670465c8962e",
          "name": "Structured Transcript Summary",
          "type": "@n8n/n8n-nodes-langchain.chainLlm",
          "position": [
            2500,
            -260
          ],
          "parameters": {
            "text": "=<system_prompt>\nYOU ARE AN EXPERT CALL ANALYST AGENT. YOUR TASK IS TO ANALYZE A CALL TRANSCRIPT BELOW\nTranscript: \"{{ $('Webhook').item.json.body.call.transcript }}\"\n\nPRODUCE A STRUCTURED REPORT STRICTLY IN THE FOLLOWING FORMAT:\n\n😓 PAINS & NEEDS\n1. [List user’s main problems, frustrations, or goals, in numbered points]\n2. [Ensure clarity and conciseness]\n\n❓ TOP QUESTIONS\n1. [List the exact or implied questions the user asked during the call]\n2. [Use simple, clear language]\n3. [Keep as numbered points]\n\n🤖 AI RESPONSES\n1. [Summarize how the AI/agent responded, ensuring accuracy and completeness]\n2. [List multiple responses if relevant]\n\n🚩 OBJECTIONS & RISKS\n1. [Capture any stated or implied objections, doubts, or risks that may affect conversion]\n2. [If none, explicitly state “No specific objections mentioned, but potential risks could arise...”]\n\n⚠️ ISSUES IDENTIFIED:  \n[List the key issues that arose during the call. Use bullet points if multiple issues are present. Highlight both customer-related and AI/agent-related issues.]\n\n💡 RECOMMENDATIONS:  \n- Ensure the AI agent prompts for multiple identifiers (email, DOB, etc.) if phone number fails  \n- Implement a more robust error message to guide customers when details cannot be verified  \n\n📝 CALL SUMMARY\n[Provide a concise summary (2–3 sentences) describing the user’s overall intent, interaction quality, and potential outcome]\n\n---\n\n### CHAIN OF THOUGHTS TO FOLLOW\n\n1. UNDERSTAND the transcript content and user’s intent  \n2. IDENTIFY pains, needs, and frustrations  \n3. CAPTURE explicit and implicit questions asked by the user  \n4. ANALYZE how the AI/agent responded and summarize key points  \n5. EVALUATE objections or risks that may hinder conversion or satisfaction  \n6. FORMULATE the next best step to move the conversation forward  \n7. SUMMARIZE the call in a clear, professional tone  \n\n---\n\n### WHAT NOT TO DO\n\n- NEVER CHANGE THE STRUCTURE OR HEADINGS  \n- NEVER ADD EXTRA SECTIONS OR COMMENTARY OUTSIDE THE FORMAT  \n- NEVER WRITE LONG PARAGRAPHS (must use bullet/numbered format except summary)  \n- NEVER OMIT A SECTION, even if data is missing (use a reasoned placeholder if necessary)  \n- NEVER MIX FORMATS (keep icons + bold section names as shown)  \n\n---\n\n### FEW-SHOT EXAMPLE\n\n**Example Input (Transcript):**\n\"Caller: Hi, I want to book my first appointment.  \nAgent: Sure, let me check availability.  \nCaller: Can you confirm the email on file?  \nAgent: Yes, it's user@example.com.  \nCaller: Great, I need the next available slot.  \nAgent: The next available is tomorrow at 10 AM.  \nCaller: Perfect, please confirm it.  \n[Duration: 2.5 minutes]\"\n\n**Example Output:**\n\n😓 PAINS & NEEDS  \n1. Scheduling an initial exam appointment quickly.  \n2. Ensuring contact details (email) are correctly confirmed.  \n\n❓ TOP QUESTIONS  \n1. What appointment can I schedule?  \n2. Can you confirm my email on file?  \n3. What's the next available appointment time?  \n\n🤖 AI RESPONSES  \n1. The AI checked appointment availability.  \n2. The AI confirmed the user’s email and appointment details.  \n\n🚩 OBJECTIONS & RISKS  \n1. No specific objections mentioned, but potential concerns about scheduling flexibility may arise later.  \n\n⚠️ ISSUES IDENTIFIED:  \n- Customer struggled to provide accurate phone number due to forgetfulness  \n- AI could not find matching records for the provided information  \n\n📝 CALL SUMMARY  \nThe caller expressed a clear intent to book an appointment, confirmed personal details, and agreed on the next available slot. This indicates strong interest in moving forward with the service.  \n\n</system_prompt>\n",
            "messages": {
              "messageValues": [
                {
                  "message": "You are an AI call analyst specializing in dental/medical practice conversations. Analyze call transcripts and create structured summaries that capture key details, caller information, appointment discussions, AI performance, and outcomes. Focus on actionable insights for practice improvement. Use bullet points and include specific details like names, dates, and symptoms when mentioned."
                }
              ]
            },
            "promptType": "define"
          },
          "typeVersion": 1.6,
          "alwaysOutputData": false
        },
        {
          "id": "948bf8aa-4375-4b2b-b9be-366df820ebc2",
          "name": "All Calls + Negative",
          "type": "n8n-nodes-base.slack",
          "position": [
            3240,
            -280
          ],
          "webhookId": "5ea0aa02-f03e-44be-9bf3-6136e6a35b73",
          "parameters": {
            "text": "={{ $json.text }}",
            "select": "channel",
            "channelId": {
              "__rl": true,
              "mode": "list",
              "value": "C09J6ABP9ML",
              "cachedResultName": "sales-ai-all-calls"
            },
            "otherOptions": {
              "thread_ts": {
                "replyValues": {
                  "thread_ts": "={{ $('All Calls Report Creation').item.json.message_timestamp }}"
                }
              }
            }
          },
          "credentials": {
            "slackApi": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "31a65096-362e-4f99-a49b-8840f1b73286",
          "name": "All Calls Report Creation",
          "type": "n8n-nodes-base.slack",
          "position": [
            1740,
            -280
          ],
          "webhookId": "5ea0aa02-f03e-44be-9bf3-6136e6a35b73",
          "parameters": {
            "text": "={{ $json.text }}",
            "select": "channel",
            "channelId": {
              "__rl": true,
              "mode": "list",
              "value": "C09J6ABP9ML",
              "cachedResultName": "sales-ai-all-calls"
            },
            "otherOptions": {}
          },
          "credentials": {
            "slackApi": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "5562d521-e755-48ea-99ea-a26916db57e0",
          "name": "-ive Calls Report Creation",
          "type": "n8n-nodes-base.slack",
          "position": [
            2240,
            -360
          ],
          "webhookId": "e12f3180-1abf-49d0-aef4-953112dcd728",
          "parameters": {
            "text": "={{ $('Call report').item.json.text }}",
            "select": "channel",
            "channelId": {
              "__rl": true,
              "mode": "list",
              "value": "C09JC2JLNTW",
              "cachedResultName": "sales-ai-negative-calls"
            },
            "otherOptions": {}
          },
          "credentials": {
            "slackApi": {
              "id": "YOUR_CREDENTIAL_ID",
              "name": "API account"
            }
          },
          "typeVersion": 2.3
        }
      ],
      "active": true,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "39f01ea4-81d2-4982-bb9c-4a8e672f0ab0",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Start Date",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Successful Booking",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If1": {
          "main": [
            [
              {
                "node": "dnc",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If2": {
          "main": [
            [
              {
                "node": "remove tag",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switch": {
          "main": [
            [
              {
                "node": "HTTP Request2",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Switching Request Type",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "creatcontact",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Data Preprocessing",
                "type": "main",
                "index": 0
              },
              {
                "node": "If Phone Call",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Webhook": {
          "main": [
            [
              {
                "node": "Switch",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Add Tags": {
          "main": [
            [
              {
                "node": "Call Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Call Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Call Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Not Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Not Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Not Answered",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Not Connected",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Not Connected",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Don't Contact",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Don't Contact",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Don't Contact",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Call Transfer",
                "type": "main",
                "index": 0
              }
            ],
            []
          ]
        },
        "End Date": {
          "main": [
            [
              {
                "node": "Get Available Slots",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "For Call": {
          "main": [
            [
              {
                "node": "ISO 8601 Formatter",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "For Chat": {
          "main": [
            [
              {
                "node": "ISO 8601 Formatter",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Webhook2": {
          "main": [
            [
              {
                "node": "HTTP Request4",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "addOneDay": {
          "main": [
            [
              {
                "node": "End Date",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Open Slots": {
          "main": [
            [
              {
                "node": "Human Friendly Time Formatter1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Start Date": {
          "main": [
            [
              {
                "node": "addOneDay",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Call report": {
          "main": [
            [
              {
                "node": "All Calls Report Creation",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Edit Fields": {
          "main": [
            [
              {
                "node": "Inbound Call",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Handle Error": {
          "main": [
            [
              {
                "node": "Respond to Webhook",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "IF Confirmed": {
          "main": [
            [
              {
                "node": "Appointment Confirmed",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "creatcontact": {
          "main": [
            [
              {
                "node": "set contact id",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Handle Error",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Call Answered": {
          "main": [
            [
              {
                "node": "IF Confirmed",
                "type": "main",
                "index": 0
              },
              {
                "node": "Add Sentiment",
                "type": "main",
                "index": 0
              },
              {
                "node": "If1",
                "type": "main",
                "index": 0
              },
              {
                "node": "If2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "HTTP Request2": {
          "main": [
            []
          ]
        },
        "HTTP Request4": {
          "main": [
            [
              {
                "node": "If chat session Exists1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "HTTP Request5": {
          "main": [
            [
              {
                "node": "Respond to GHL1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If Phone Call": {
          "main": [
            [
              {
                "node": "Call report",
                "type": "main",
                "index": 0
              }
            ],
            []
          ]
        },
        "Chat Id Input2": {
          "main": [
            [
              {
                "node": "HTTP Request5",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Chat Id Input3": {
          "main": [
            [
              {
                "node": "HTTP Request5",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "IF Data Exists": {
          "main": [
            [
              {
                "node": "Update Details",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Name Extractor": {
          "main": [
            [
              {
                "node": "IF Data Exists",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Negative Calls": {
          "main": [
            []
          ]
        },
        "set contact id": {
          "main": [
            [
              {
                "node": "Respond to Webhook",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "bookAppointment": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If Error Detected": {
          "main": [
            [
              {
                "node": "Error Handling",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Add Tags",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Creat Chat Id GHL1": {
          "main": [
            [
              {
                "node": "Chat Id Input2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Data Preprocessing": {
          "main": [
            [
              {
                "node": "Update Custom Fields",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "ISO 8601 Formatter": {
          "main": [
            [
              {
                "node": "bookAppointment",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "OpenAI Chat Model2": {
          "ai_languageModel": [
            [
              {
                "node": "Call report",
                "type": "ai_languageModel",
                "index": 0
              },
              {
                "node": "Structured Transcript Summary",
                "type": "ai_languageModel",
                "index": 0
              }
            ]
          ]
        },
        "Respond to Webhook": {
          "main": [
            [
              {
                "node": "Edit Fields",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Successful Booking": {
          "main": [
            [
              {
                "node": "Human Friendly Time Formatter",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Create Chat Session": {
          "main": [
            [
              {
                "node": "Creat Chat Id GHL1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get Available Slots": {
          "main": [
            [
              {
                "node": "Open Slots",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Update Custom Fields": {
          "main": [
            [
              {
                "node": "If Error Detected",
                "type": "main",
                "index": 0
              },
              {
                "node": "Name Extractor",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If Negative Sentiment2": {
          "main": [
            [
              {
                "node": "-ive Calls Report Creation",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Structured Transcript Summary",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If Negative Sentiment3": {
          "main": [
            [
              {
                "node": "Negative Calls",
                "type": "main",
                "index": 0
              },
              {
                "node": "All Calls + Negative",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "All Calls",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switching Request Type": {
          "main": [
            [
              {
                "node": "For Call",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "For Chat",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "If chat session Exists1": {
          "main": [
            [
              {
                "node": "Create Chat Session",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Chat Id Input3",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "All Calls Report Creation": {
          "main": [
            [
              {
                "node": "If Negative Sentiment2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "-ive Calls Report Creation": {
          "main": [
            [
              {
                "node": "Structured Transcript Summary",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Human Friendly Time Formatter": {
          "main": [
            [
              {
                "node": "Successful Booking to GHL",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Structured Transcript Summary": {
          "main": [
            [
              {
                "node": "If Negative Sentiment3",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Human Friendly Time Formatter1": {
          "main": [
            [
              {
                "node": "Successful Booking to GHL1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }