{
  "name": "SynapsAI — Morning digest",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1-5"
            }
          ]
        }
      },
      "id": "604ac729-0613-54af-b660-27f2a8308ad4",
      "name": "Weekdays 08:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "resource": "conversation",
        "operation": "getAll",
        "filters": {
          "from": "={{ $today.minus({ days: 1 }).toISO() }}",
          "to": "={{ $today.toISO() }}"
        },
        "returnAll": true
      },
      "id": "690e1812-7dfd-59d5-80c6-0e33e5597892",
      "name": "Yesterday's conversations",
      "type": "n8n-nodes-synapsai.synapsAi",
      "typeVersion": 1,
      "position": [
        260,
        0
      ],
      "credentials": {
        "synapsAiApi": {
          "id": "",
          "name": "SynapsAI API"
        }
      }
    },
    {
      "parameters": {
        "resource": "conversation",
        "operation": "getAll",
        "filters": {
          "csatMin": 1,
          "csatMax": 2,
          "from": "={{ $today.minus({ days: 1 }).toISO() }}",
          "to": "={{ $today.toISO() }}"
        },
        "returnAll": true
      },
      "id": "e6b5fb4e-2f9f-5b56-8b12-ffe2afadd82f",
      "name": "Rated 1-2 yesterday",
      "type": "n8n-nodes-synapsai.synapsAi",
      "typeVersion": 1,
      "position": [
        520,
        0
      ],
      "credentials": {
        "synapsAiApi": {
          "id": "",
          "name": "SynapsAI API"
        }
      },
      "executeOnce": true
    },
    {
      "parameters": {
        "resource": "lead",
        "operation": "getAll",
        "agentKey": "",
        "leadFilters": {},
        "returnAll": true
      },
      "id": "c94a873b-f3bd-5ec6-96b6-9092dd27d1ad",
      "name": "Leads",
      "type": "n8n-nodes-synapsai.synapsAi",
      "typeVersion": 1,
      "position": [
        780,
        0
      ],
      "credentials": {
        "synapsAiApi": {
          "id": "",
          "name": "SynapsAI API"
        }
      },
      "executeOnce": true
    },
    {
      "parameters": {
        "jsCode": "const conversations = $('Yesterday\\'s conversations').all().length;\nconst lowRated = $('Rated 1-2 yesterday').all().length;\nconst leads = $('Leads').all().length;\nreturn [{ json: { subject: `SynapsAI — ${conversations} conversations, ${leads} leads`, text: `Conversations: ${conversations}\\nRated 1-2: ${lowRated}\\nLeads: ${leads}` } }];"
      },
      "id": "37c0587a-2bf0-50b8-ae96-ad841ced80c5",
      "name": "Build digest",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        0
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "fromEmail": "digest@your-company.example",
        "toEmail": "team@your-company.example",
        "subject": "={{ $json.subject }}",
        "emailFormat": "text",
        "text": "={{ $json.text }}",
        "options": {}
      },
      "id": "1be862a6-d806-50f3-b630-eb86ed526f46",
      "name": "E-mail digest",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        1300,
        0
      ]
    }
  ],
  "connections": {
    "Weekdays 08:00": {
      "main": [
        [
          {
            "node": "Yesterday's conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Yesterday's conversations": {
      "main": [
        [
          {
            "node": "Rated 1-2 yesterday",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rated 1-2 yesterday": {
      "main": [
        [
          {
            "node": "Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Leads": {
      "main": [
        [
          {
            "node": "Build digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build digest": {
      "main": [
        [
          {
            "node": "E-mail digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "description": "At 08:00 on weekdays, yesterday’s conversations, the low-rated ones and the leads are counted and e-mailed.",
    "requires": "n8n-nodes-synapsai >= 0.1.0; SynapsAI GROWTH+"
  },
  "pinData": {},
  "tags": []
}