{
  "name": "BuilderStack — Monthly summary email",
  "flow": [
    {
      "id": 1,
      "module": "google-sheets:filterRows",
      "version": 2,
      "parameters": {},
      "mapper": {
        "mode": "select",
        "from": "drive",
        "spreadsheetId": "{{LEADS_SPREADSHEET_ID}}",
        "sheetId": "{{SHEET_NAME}}",
        "includesHeaders": true,
        "tableFirstRow": "A1:F1",
        "limit": 500,
        "filter": [
          [
            {
              "a": "{{0}}",
              "b": "{{formatDate(addMonths(now; -1); \"YYYY-MM\")}}",
              "o": "text:contain"
            }
          ]
        ]
      },
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        },
        "parameters": [
          {
            "name": "__IMTCONN__",
            "type": "account:google",
            "label": "Connection",
            "required": true
          }
        ]
      }
    },
    {
      "id": 2,
      "module": "util:FunctionAggregator",
      "version": 1,
      "parameters": {
        "feeder": 1
      },
      "mapper": {
        "function": "count",
        "value": "{{1.`0`}}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0
        }
      }
    },
    {
      "id": 3,
      "module": "google-sheets:filterRows",
      "version": 2,
      "parameters": {},
      "mapper": {
        "mode": "select",
        "from": "drive",
        "spreadsheetId": "{{LEADS_SPREADSHEET_ID}}",
        "sheetId": "{{SHEET_NAME}}",
        "includesHeaders": true,
        "tableFirstRow": "A1:F1",
        "limit": 500,
        "filter": [
          [
            {
              "a": "{{0}}",
              "b": "{{formatDate(addMonths(now; -1); \"YYYY-MM\")}}",
              "o": "text:contain"
            },
            {
              "a": "{{5}}",
              "b": "closed",
              "o": "text:equal"
            }
          ]
        ]
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        },
        "parameters": [
          {
            "name": "__IMTCONN__",
            "type": "account:google",
            "label": "Connection",
            "required": true
          }
        ]
      }
    },
    {
      "id": 4,
      "module": "util:FunctionAggregator",
      "version": 1,
      "parameters": {
        "feeder": 3
      },
      "mapper": {
        "function": "count",
        "value": "{{3.`0`}}"
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0
        }
      }
    },
    {
      "id": 5,
      "module": "google-email:ActionSendEmail",
      "version": 2,
      "parameters": {},
      "mapper": {
        "cc": [],
        "to": [
          "{{CLIENT_EMAIL}}"
        ],
        "bcc": [],
        "from": "",
        "html": "<p>Leads: {{2.result}}</p><p>Closed: {{4.result}}</p><p>{{MONTHLY_NOTE}}</p>",
        "subject": "Monthly summary — {{formatDate(addMonths(now; -1); \"MMMM YYYY\")}}",
        "attachments": []
      },
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0
        },
        "parameters": [
          {
            "name": "account",
            "type": "account:google-restricted",
            "label": "Connection"
          }
        ]
      }
    }
  ],
  "metadata": {
    "instant": false,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "eu2.make.com"
  }
}