{
  "name": "Send daily or weekly Ringee sales call reports to Slack",
  "nodes": [
    {
      "parameters": {
        "errorMessage": "A service step failed. Inspect the failed execution and the source record. Reconcile any accepted Ringee call before retrying; never change its call key to bypass an ambiguous failure."
      },
      "id": "ed815cb9-eda1-44d4-8692-abfb8114cd7e",
      "name": "Failure requires reconciliation",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        2300,
        1700
      ]
    },
    {
      "parameters": {
        "content": "### How it works\nA schedule retrieves every page of calls for a bounded previous-day or previous-week window. The workflow deduplicates by call ID and aggregates total calls, calls with answeredAt, recorded duration and canonical outcome counts. It sends a concise report to Slack.\n\nThis template is for Sales managers, agency account owners and operations teams. A repeatable activity report without invented revenue, cost or qualification metrics. Ringee runs the voice conversation; n8n manages the surrounding records and decisions.\n\n### Setup\nInstall the verified **n8n-nodes-ringee 0.1.2** package. Create a Ringee account and a workspace Custom Integration, then select its API key in an n8n credential. Connect Slack and select every blank destination. Signed triggers also need the Signing Secret and the integration Outbound URL. Import into a new inactive workflow and test dedicated demonstration records before activation.\n\n### Customization\nKeep the bounded analysis waits and explicit pending states. Read the companion setup guide for column names, field mappings and limitations. [Create your Ringee account](https://ringee.io/integrations/n8n?utm_source=n8n&utm_medium=template&utm_campaign=ringee_workflows&utm_content=12-sales-call-performance-report).",
        "width": 570,
        "height": 700,
        "color": 1
      },
      "id": "d4ead066-2316-485f-82e5-9ca6e535ccc0",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -600,
        -320
      ]
    },
    {
      "parameters": {
        "content": "## Configure the source\nSelect credentials and destinations. Calling workflows require trusted permission evidence and an IANA timezone for each recipient.",
        "width": 720,
        "height": 400,
        "color": 7
      },
      "id": "2b962b2e-f8f7-4c75-8b4d-64f8ab44ae82",
      "name": "1. Configure and admit records",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        80
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "707633fc-84a5-4884-894c-4f8abb49a5e1",
              "name": "reportDays",
              "value": 1,
              "type": "number"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "39cff2f1-1511-453d-8cd3-42e3c8819319",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        260,
        300
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * *"
            }
          ]
        }
      },
      "id": "a65cb143-6160-4ebd-8e38-c45f83a11b72",
      "name": "Run on schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const days = Number($('Configuration').first().json.reportDays);\nif (![1, 7].includes(days)) throw new Error('reportDays must be 1 or 7');\nconst end = $now.startOf('day');\nreturn [{json:{from:end.minus({days}).toISO(),to:end.minus({milliseconds:1}).toISO()}}];"
      },
      "id": "fe3d1b56-be85-4112-8dac-ec0e03be4295",
      "name": "Previous complete reporting window",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        300
      ]
    },
    {
      "parameters": {
        "resource": "call",
        "operation": "getMany",
        "returnAll": true,
        "filters": {
          "dateFrom": "={{ $('Previous complete reporting window').item.json.from }}",
          "dateTo": "={{ $('Previous complete reporting window').item.json.to }}"
        }
      },
      "id": "d99a073e-441c-40aa-8687-cf970373ce19",
      "name": "Read every page of calls",
      "type": "n8n-nodes-ringee.ringee",
      "typeVersion": 1,
      "position": [
        780,
        300
      ],
      "onError": "continueErrorOutput",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "function aggregateCalls(items, config, now) {\n\tconst seen = new Set();\n\tconst rows = items\n\t\t.map((item) => item.json)\n\t\t.filter((row) => row.id && !seen.has(row.id) && seen.add(row.id));\n\tconst outcomes = {};\n\tlet answered = 0;\n\tlet durationSeconds = 0;\n\tfor (const row of rows) {\n\t\tif (\n\t\t\trow.answeredAt &&\n\t\t\t!['voicemail', 'no_answer', 'busy'].includes(String(row.status)) &&\n\t\t\t!['voicemail', 'no_answer', 'busy'].includes(String(row.outcome))\n\t\t)\n\t\t\tanswered++;\n\t\tif (Number.isFinite(Number(row.durationSeconds)))\n\t\t\tdurationSeconds += Math.max(0, Number(row.durationSeconds));\n\t\tconst outcome = String(row.outcome || 'not_recorded');\n\t\toutcomes[outcome] = (outcomes[outcome] ?? 0) + 1;\n\t}\n\treturn {\n\t\tgeneratedAt: now.toISO(),\n\t\treportDays: Number(config.reportDays),\n\t\ttotalCalls: rows.length,\n\t\tansweredCalls: answered,\n\t\trecordedDurationSeconds: durationSeconds,\n\t\toutcomes,\n\t\tnotification:\n\t\t\t'Ringee call report (' +\n\t\t\tNumber(config.reportDays) +\n\t\t\t' days): ' +\n\t\t\trows.length +\n\t\t\t' calls; ' +\n\t\t\tanswered +\n\t\t\t' with answeredAt; ' +\n\t\t\tdurationSeconds +\n\t\t\t' recorded seconds. Outcomes: ' +\n\t\t\tJSON.stringify(outcomes) +\n\t\t\t'. Calls are grouped by createdAt, not completion time. Costs and agent qualification scores are not available in this report.',\n\t};\n}\nreturn [{json:aggregateCalls($input.all(), $('Configuration').first().json, $now)}];"
      },
      "id": "41df6258-f6cf-4200-84b2-7481b0eede28",
      "name": "Aggregate recorded call metrics",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1080,
        300
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "text": "={{ $('Aggregate recorded call metrics').item.json.notification }}",
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "id": "33d1a37c-83d5-47e5-83fb-24813eaab17e",
      "name": "Send sales activity report",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.7,
      "position": [
        1400,
        300
      ],
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "content": "## Read and report the complete period\nThe Ringee node paginates through the selected window. Aggregate actual call IDs and outcomes, then deliver the report to your chosen Slack channel.",
        "width": 1000,
        "height": 440,
        "color": 7
      },
      "id": "ec05a419-c73f-474b-8558-3a7f9acdae70",
      "name": "Read and report",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        740,
        80
      ]
    }
  ],
  "connections": {
    "Run on schedule": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Previous complete reporting window",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read every page of calls": {
      "main": [
        [
          {
            "node": "Aggregate recorded call metrics",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Failure requires reconciliation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Previous complete reporting window": {
      "main": [
        [
          {
            "node": "Read every page of calls",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send sales activity report": {
      "main": [
        [],
        [
          {
            "node": "Failure requires reconciliation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate recorded call metrics": {
      "main": [
        [
          {
            "node": "Send sales activity report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "executionTimeout": 3600
  },
  "pinData": {},
  "tags": []
}
