{
  "name": "SynapsAI — Morning digest",
  "flow": [
    {
      "id": 1,
      "module": "synapsai:listConversations",
      "version": 1,
      "parameters": {
        "__IMTCONN__": null
      },
      "mapper": {
        "from": "{{addDays(startOfDay(now); -1)}}",
        "to": "{{startOfDay(now)}}",
        "limit": 1000
      },
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        }
      }
    },
    {
      "id": 2,
      "module": "builtin:BasicAggregator",
      "version": 1,
      "parameters": {
        "feeder": 1
      },
      "mapper": {
        "chatId": "{{1.chatId}}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0
        }
      }
    },
    {
      "id": 3,
      "module": "synapsai:listConversations",
      "version": 1,
      "parameters": {
        "__IMTCONN__": null
      },
      "mapper": {
        "csatMin": 1,
        "csatMax": 2,
        "from": "{{addDays(startOfDay(now); -1)}}",
        "to": "{{startOfDay(now)}}",
        "limit": 1000
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      }
    },
    {
      "id": 4,
      "module": "builtin:BasicAggregator",
      "version": 1,
      "parameters": {
        "feeder": 3
      },
      "mapper": {
        "chatId": "{{3.chatId}}"
      },
      "metadata": {
        "designer": {
          "x": 900,
          "y": 0
        }
      }
    },
    {
      "id": 5,
      "module": "synapsai:listLeads",
      "version": 1,
      "parameters": {
        "__IMTCONN__": null
      },
      "mapper": {
        "agentKey": "",
        "limit": 1000
      },
      "metadata": {
        "designer": {
          "x": 1200,
          "y": 0
        }
      }
    },
    {
      "id": 6,
      "module": "builtin:BasicAggregator",
      "version": 1,
      "parameters": {
        "feeder": 5
      },
      "mapper": {
        "leadId": "{{5.leadId}}"
      },
      "metadata": {
        "designer": {
          "x": 1500,
          "y": 0
        }
      }
    },
    {
      "id": 7,
      "module": "email:ActionSendEmail",
      "version": 7,
      "parameters": {},
      "mapper": {
        "to": [
          "team@your-company.example"
        ],
        "subject": "SynapsAI — {{length(2.array)}} conversations, {{length(6.array)}} leads",
        "contentType": "text",
        "text": "Conversations: {{length(2.array)}}\nRated 1-2: {{length(4.array)}}\nLeads: {{length(6.array)}}"
      },
      "metadata": {
        "designer": {
          "x": 1800,
          "y": 0
        }
      }
    }
  ],
  "metadata": {
    "version": 1,
    "instant": false,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false
    },
    "designer": {
      "orphans": []
    },
    "requires": "SynapsAI Make app (synapsai) >= 1.0.0; SynapsAI GROWTH+"
  }
}