{
  "name": "12 · Weekly Client Report Email",
  "nodes": [
    {
      "name": "Every Friday 5pm",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        112
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                5
              ],
              "triggerAtHour": 17
            }
          ]
        }
      }
    },
    {
      "name": "List All Clients",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        224,
        112
      ],
      "parameters": {
        "resource": "client",
        "operation": "list"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "List Websites",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        448,
        112
      ],
      "parameters": {
        "resource": "website",
        "operation": "list"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Build Report Context",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        672,
        112
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "clients",
              "value": "={{ JSON.stringify($(\"List All Clients\").first().json.list || []) }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "websites",
              "value": "={{ JSON.stringify($(\"List Websites\").first().json.list || []) }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "report_date",
              "value": "={{ $now.toFormat(\"MMMM d, yyyy\") }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Generate & Send Reports",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        896,
        112
      ],
      "parameters": {
        "promptType": "define",
        "text": "=Generate and send weekly performance report emails to each client.\n\nDate: {{ $json.report_date }}\nClients (JSON): {{ $json.clients }}\nWebsites (JSON): {{ $json.websites }}\n\nFor each client that has at least one website, compose a brief weekly report email:\n- Greet by name\n- List their website(s) with URLs\n- Note that detailed analytics are available in their dashboard\n- Encourage them to check their site performance\n- Sign off from Lindo AI\n\nSend each report via Emailr to the client's email address. If there are multiple clients, send separate emails to each.",
        "options": {
          "systemMessage": "You generate and send weekly client performance report emails. Send one email per client via Emailr."
        }
      }
    },
    {
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        912,
        336
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Yuica5wlzDrhFTNk",
          "name": "OpenAi account"
        }
      }
    },
    {
      "name": "Emailr",
      "type": "n8n-nodes-emailr.emailrTool",
      "typeVersion": 1,
      "position": [
        1040,
        336
      ],
      "parameters": {
        "from": "lindo.ai <reports@lindo.ai>",
        "to": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', '') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', '') }}",
        "html": "=",
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text_Body', ``, 'string') }}"
      },
      "credentials": {
        "emailrApi": {
          "id": "1QJ6NqiurNRi9d4C",
          "name": "Emailr account"
        }
      }
    },
    {
      "name": "Slack: Reports Sent",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        1248,
        112
      ],
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "#client-success",
        "text": "=📊 Weekly client reports sent for {{ $(\"Build Report Context\").first().json.report_date }}."
      },
      "webhookId": "8a1033a9-4f3b-446f-b2db-bb3d56b946fa",
      "credentials": {
        "slackApi": {
          "id": "sXUjiMVMx3RPbSTG",
          "name": "Slack account"
        }
      }
    },
    {
      "name": "Sticky Note fdf0de8b",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        624,
        384
      ],
      "parameters": {
        "content": "### 12 · Weekly Client Report Email\n\n**How it works:** Every Friday at 5pm → lists all clients and websites from Lindo → builds report context → AI agent composes personalised performance report emails for each client → sends via Emailr → posts summary to Slack.\n\n**Setup:** Connect Lindo API credentials. Configure Emailr for reports@lindo.ai sender. Connect Slack to #client-success channel.\n\n**Customisation:** Change schedule day/time. Add real analytics data from your dashboard API. Customise email template and tone. Add filtering to skip inactive clients. Include credit balance in reports.",
        "color": 2,
        "width": 1548,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 9149001a",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        624,
        384
      ],
      "parameters": {
        "content": "## Data Collection\nLists all clients and websites to build the report context for the AI agent.",
        "color": 1,
        "width": 972,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 286c37ea",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        624,
        384
      ],
      "parameters": {
        "content": "## AI Report Generation\nGPT-4o composes personalised emails per client and sends each via Emailr.",
        "color": 1,
        "width": 300,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 61b21f29",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        624,
        384
      ],
      "parameters": {
        "content": "## Completion Alert\nPosts to Slack #client-success confirming all reports were sent.",
        "color": 1,
        "width": 300,
        "height": 200
      }
    }
  ],
  "connections": {
    "Every Friday 5pm": {
      "main": [
        [
          {
            "node": "List All Clients",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List All Clients": {
      "main": [
        [
          {
            "node": "List Websites",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Websites": {
      "main": [
        [
          {
            "node": "Build Report Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Report Context": {
      "main": [
        [
          {
            "node": "Generate & Send Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate & Send Reports": {
      "main": [
        [
          {
            "node": "Slack: Reports Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "Generate & Send Reports",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Emailr": {
      "ai_tool": [
        [
          {
            "node": "Generate & Send Reports",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}