{
  "name": "Daily Business Digest. A template by The Gridline Company",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 18 * * 1-5"
            }
          ]
        }
      },
      "id": "schedule-301",
      "name": "Weekdays at 6 PM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Today",
          "mode": "list"
        },
        "options": {}
      },
      "id": "sheets-302",
      "name": "Read Today's Activity",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.4,
      "position": [460, 300],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "REPLACE_WITH_YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "id": "aggregate-303",
      "name": "Combine Rows",
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [680, 300]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "You write end-of-day business summaries for a small business owner. Be conversational and friendly. Keep it to 3-4 sentences. Include: total bookings or sales, anything unusual or notable, and one specific thing to celebrate or address tomorrow. End with a one-line plain-language headline.",
              "role": "system"
            },
            {
              "content": "Today's data:\n{{ JSON.stringify($json.data) }}",
              "role": "user"
            }
          ]
        },
        "options": {}
      },
      "id": "openai-304",
      "name": "Write Summary",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [900, 300],
      "credentials": {
        "openAiApi": {
          "id": "REPLACE_WITH_YOUR_OPENAI_CREDENTIAL_ID",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "REPLACE_WITH_YOUR_EMAIL@example.com",
        "subject": "=Your daily digest for {{ $now.toFormat('cccc, LLLL d') }}",
        "emailType": "html",
        "message": "=<h2>Your day, in 30 seconds</h2>\n<p style=\"font-size: 16px; line-height: 1.6;\">{{ $json.message.content }}</p>\n<hr>\n<p style=\"font-size: 12px; color: #666;\">Sent automatically every weekday at 6 PM by your Daily Digest workflow. Built with n8n by The Gridline Company.</p>",
        "options": {}
      },
      "id": "gmail-305",
      "name": "Email the Digest",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [1120, 300],
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE_WITH_YOUR_GMAIL_CREDENTIAL_ID",
          "name": "Gmail account"
        }
      }
    }
  ],
  "connections": {
    "Weekdays at 6 PM": {
      "main": [
        [{ "node": "Read Today's Activity", "type": "main", "index": 0 }]
      ]
    },
    "Read Today's Activity": {
      "main": [
        [{ "node": "Combine Rows", "type": "main", "index": 0 }]
      ]
    },
    "Combine Rows": {
      "main": [
        [{ "node": "Write Summary", "type": "main", "index": 0 }]
      ]
    },
    "Write Summary": {
      "main": [
        [{ "node": "Email the Digest", "type": "main", "index": 0 }]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "gridline-004",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "gridline-company-templates"
  },
  "tags": [
    { "name": "Gridline Company", "id": "gridline" },
    { "name": "Reporting", "id": "reporting" }
  ]
}
