{
  "name": "Customer Service Call Workflow",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "binaryPropertyName": "data",
        "options": {}
      },
      "name": "Read Excel File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 2,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"Status\"]}}",
              "operation": "notEqual",
              "value2": "Signed Up"
            },
            {
              "value1": "={{$json[\"Status\"]}}",
              "operation": "notEqual",
              "value2": "Not Interested"
            }
          ]
        },
        "combineOperation": "all"
      },
      "name": "Filter Uncontacted",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "name": "Split In Batches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "resource": "call",
        "operation": "make",
        "from": "+1234567890",
        "to": "={{$json[\"Phone\"]}}",
        "twiml": "=<Response>\n  <Say voice=\"Polly.Joanna\">Hello {{$json[\"Name\"]}}, this is Sarah calling from FitLife Personal Training. I'm reaching out to see if you'd be interested in our personalized training programs that can help you achieve your fitness goals.</Say>\n  <Gather input=\"speech\" action=\"https://your-webhook-url.com/gather\" timeout=\"5\" speechTimeout=\"auto\">\n    <Say>Are you currently working out regularly? Please respond yes or no.</Say>\n  </Gather>\n  <Say>I didn't catch that. I'll follow up with you via email. Have a great day!</Say>\n</Response>",
        "options": {}
      },
      "name": "Make Twilio Call",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "gather",
        "responseMode": "responseNode",
        "options": {}
      },
      "name": "Webhook - Call Response",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"body\"][\"SpeechResult\"]}}",
              "operation": "contains",
              "value2": "yes"
            }
          ]
        }
      },
      "name": "IF Interested",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1450,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=<Response>\n  <Say voice=\"Polly.Joanna\">That's wonderful! We offer personalized one-on-one training sessions tailored to your fitness level and goals. Our trainers are certified professionals with years of experience.</Say>\n  <Gather input=\"speech\" action=\"https://your-webhook-url.com/signup\" timeout=\"5\" speechTimeout=\"auto\">\n    <Say>Would you like to sign up for a free consultation session? Say yes to schedule, or no thank you if you're not interested.</Say>\n  </Gather>\n</Response>"
      },
      "name": "Respond - Pitch Service",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1650,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=<Response>\n  <Say voice=\"Polly.Joanna\">No problem! If you change your mind in the future, feel free to reach out. Have a great day!</Say>\n  <Hangup/>\n</Response>"
      },
      "name": "Respond - Not Interested",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1650,
        400
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "signup",
        "responseMode": "responseNode",
        "options": {}
      },
      "name": "Webhook - Signup Response",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        1850,
        200
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"body\"][\"SpeechResult\"]}}",
              "operation": "contains",
              "value2": "yes"
            }
          ]
        }
      },
      "name": "IF Wants to Sign Up",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        2050,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=<Response>\n  <Say voice=\"Polly.Joanna\">Excellent! I'm scheduling a free consultation for you. You'll receive a confirmation email and text message shortly with all the details. Thank you for choosing FitLife, and we look forward to helping you reach your fitness goals!</Say>\n  <Hangup/>\n</Response>"
      },
      "name": "Respond - Confirmed",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        2250,
        100
      ]
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "=<Response>\n  <Say voice=\"Polly.Joanna\">I understand. If you'd like more information, I can send you an email with details about our services. Thank you for your time!</Say>\n  <Hangup/>\n</Response>"
      },
      "name": "Respond - Declined",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        2250,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Name",
              "value": "={{$node[\"Split In Batches\"].json[\"Name\"]}}"
            },
            {
              "name": "Phone",
              "value": "={{$node[\"Split In Batches\"].json[\"Phone\"]}}"
            },
            {
              "name": "Email",
              "value": "={{$node[\"Split In Batches\"].json[\"Email\"]}}"
            },
            {
              "name": "Status",
              "value": "Signed Up"
            },
            {
              "name": "CallDate",
              "value": "={{$now.format('yyyy-MM-dd HH:mm:ss')}}"
            },
            {
              "name": "Notes",
              "value": "Interested and signed up for consultation"
            }
          ]
        },
        "options": {}
      },
      "name": "Set Status - Signed Up",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        2450,
        100
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Name",
              "value": "={{$node[\"Split In Batches\"].json[\"Name\"]}}"
            },
            {
              "name": "Phone",
              "value": "={{$node[\"Split In Batches\"].json[\"Phone\"]}}"
            },
            {
              "name": "Email",
              "value": "={{$node[\"Split In Batches\"].json[\"Email\"]}}"
            },
            {
              "name": "Status",
              "value": "Not Interested"
            },
            {
              "name": "CallDate",
              "value": "={{$now.format('yyyy-MM-dd HH:mm:ss')}}"
            },
            {
              "name": "Notes",
              "value": "Not interested in service"
            }
          ]
        },
        "options": {}
      },
      "name": "Set Status - Not Interested",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        2450,
        400
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "your-google-sheet-id",
          "mode": "list",
          "cachedResultName": "Customer Tracking"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "name": "Update Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [
        2650,
        250
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fromEmail": "noreply@fitlife.com",
        "toEmail": "={{$node[\"Split In Batches\"].json[\"Email\"]}}",
        "subject": "Welcome to FitLife Personal Training!",
        "emailType": "html",
        "message": "=<h2>Welcome {{$node[\"Split In Batches\"].json[\"Name\"]}}!</h2>\n<p>Thank you for signing up for a free consultation with FitLife Personal Training.</p>\n<p><strong>Next Steps:</strong></p>\n<ul>\n  <li>Our team will contact you within 24 hours to schedule your session</li>\n  <li>Please prepare any fitness goals or questions you'd like to discuss</li>\n  <li>Wear comfortable workout clothes to your consultation</li>\n</ul>\n<p>We look forward to helping you achieve your fitness goals!</p>\n<p>Best regards,<br>The FitLife Team</p>",
        "options": {}
      },
      "name": "Send Confirmation Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [
        2650,
        100
      ],
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read Excel File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Excel File": {
      "main": [
        [
          {
            "node": "Filter Uncontacted",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Uncontacted": {
      "main": [
        [
          {
            "node": "Split In Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split In Batches": {
      "main": [
        [
          {
            "node": "Make Twilio Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Call Response": {
      "main": [
        [
          {
            "node": "IF Interested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Interested": {
      "main": [
        [
          {
            "node": "Respond - Pitch Service",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond - Not Interested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond - Pitch Service": {
      "main": [
        [
          {
            "node": "Webhook - Signup Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Signup Response": {
      "main": [
        [
          {
            "node": "IF Wants to Sign Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Wants to Sign Up": {
      "main": [
        [
          {
            "node": "Respond - Confirmed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond - Declined",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond - Confirmed": {
      "main": [
        [
          {
            "node": "Set Status - Signed Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond - Not Interested": {
      "main": [
        [
          {
            "node": "Set Status - Not Interested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond - Declined": {
      "main": [
        [
          {
            "node": "Set Status - Not Interested",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Status - Signed Up": {
      "main": [
        [
          {
            "node": "Send Confirmation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Status - Not Interested": {
      "main": [
        [
          {
            "node": "Update Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Confirmation Email": {
      "main": [
        [
          {
            "node": "Update Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Sheet": {
      "main": [
        [
          {
            "node": "Split In Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}