{
  "name": "Vocra — outbound calls from a Google Sheet",
  "nodes": [
    {
      "parameters": {
        "rule": { "interval": [{ "field": "hours", "hoursInterval": 1 }] }
      },
      "id": "schedule",
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "documentId": "YOUR_SHEET_ID",
        "sheetName": "Contacts",
        "filtersUI": {
          "values": [{ "lookupColumn": "called", "lookupValue": "" }]
        },
        "options": {}
      },
      "id": "read",
      "name": "Read uncalled rows",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [220, 0],
      "notes": "Filters to rows with an empty `called` column so a re-run never dials the same person twice."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://www.vocra.cloud/api/calls/outbound",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [{ "name": "Authorization", "value": "Bearer VOCRA_API_KEY" }]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ agentId: 'YOUR_AGENT_ID', to: $json.phone, variables: { first_name: $json.first_name, amount_due: $json.amount_due } }) }}",
        "options": {}
      },
      "id": "dial",
      "name": "Place call",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [440, 0],
      "notes": "`variables` fill in {{first_name}} style tokens in the agent's persona and greeting. For lists of any size, use a Vocra campaign instead — it handles concurrency, calling windows and retries for you."
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": "YOUR_SHEET_ID",
        "sheetName": "Contacts",
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "phone": "={{ $('Read uncalled rows').item.json.phone }}",
            "called": "={{ new Date().toISOString() }}",
            "vocra_call_id": "={{ $json.callId }}"
          }
        },
        "options": {}
      },
      "id": "writeback",
      "name": "Mark as called",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [660, 0]
    }
  ],
  "connections": {
    "Every hour": { "main": [[{ "node": "Read uncalled rows", "type": "main", "index": 0 }]] },
    "Read uncalled rows": { "main": [[{ "node": "Place call", "type": "main", "index": 0 }]] },
    "Place call": { "main": [[{ "node": "Mark as called", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" },
  "pinData": {}
}
