{
  "nodes": [
    {
      "name": "Read Harvey's Email",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        270,
        390
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Who Is The Email From?",
      "type": "n8n-nodes-base.switch",
      "position": [
        460,
        390
      ],
      "parameters": {
        "rules": {
          "rules": [
            {
              "value2": "Louis Litt <user@example.com>"
            }
          ]
        },
        "value1": "={{$node[\"Read Harvey's Email\"].json[\"from\"]}}",
        "dataType": "string",
        "fallbackOutput": 3
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "name": "Read Excuses File",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        670,
        230
      ],
      "parameters": {
        "filePath": "/home/n8n/Excuse_Generator.xlsx"
      },
      "typeVersion": 1
    },
    {
      "name": "Retrieve Excuses Spreadsheet Data",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        860,
        230
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Generate Excuse",
      "type": "n8n-nodes-base.function",
      "position": [
        1040,
        230
      ],
      "parameters": {
        "functionCode": "var leadinmax = 24;\nvar perpmax = 25;\nvar delaymax = 23;\nvar leadin = Math.floor((Math.random() * leadinmax ) + 1);\nvar perp = Math.floor((Math.random() * perpmax ) + 1);\nvar delay = Math.floor((Math.random() * delaymax) + 1);\n\nvar excuse = items[leadin].json.Leadin + \" \" + items[perp].json.Perpetrator + \" \" + items[delay].json.Delay;\n\nitems = [{json:{}}];\n\nitems[0].json.excuse = excuse;\nreturn items;\n"
      },
      "typeVersion": 1
    },
    {
      "name": "Merge Excuse and Mail Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1230,
        330
      ],
      "parameters": {
        "mode": "mergeByIndex"
      },
      "typeVersion": 1
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1460,
        250
      ],
      "parameters": {
        "text": "= {{$node[\"Merge Excuse and Mail Data\"].json[\"excuse\"]}}\n\nMaybe next time.\n\nHarvey",
        "options": {},
        "subject": "=RE: {{$node[\"Merge Excuse and Mail Data\"].json[\"subject\"]}}",
        "toEmail": "={{$node[\"Merge Excuse and Mail Data\"].json[\"from\"]}}",
        "fromEmail": "={{$node[\"Merge Excuse and Mail Data\"].json[\"to\"]}}"
      },
      "typeVersion": 1
    },
    {
      "name": "Slack (Louis)",
      "type": "n8n-nodes-base.slack",
      "position": [
        1470,
        410
      ],
      "parameters": {
        "text": "=Here is what Louis emailed you:\n```\n{{$node[\"Merge Excuse and Mail Data\"].json[\"textPlain\"]}}\n```\n\nHere is how \"you\" responded:\n> {{$node[\"Merge Excuse and Mail Data\"].json[\"excuse\"]}}\n\n:+1: *You're Welcome!* :smirk:",
        "channel": "private",
        "attachments": [],
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 1
    },
    {
      "name": "Slack (General)",
      "type": "n8n-nodes-base.slack",
      "position": [
        890,
        470
      ],
      "parameters": {
        "text": "You've just received an email. You may wish to check it out.",
        "channel": "private",
        "attachments": [],
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2c561ec3-f42b-572f-b9a4-61bdd1e53332",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# read harvey s email and read excuses file and retrieve excuses spreadsheet data\n\n## Purpose and structure\nThis folder contains the **read harvey s email and read excuses file and retrieve excuses spreadsheet data** workflow. Its executable nodes use `emailReadImap`, `emailSend`, `function`, `merge`, `readBinaryFile`, `slack`, `spreadsheetFile`, `switch`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nInspect connections; no recognized trigger.\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Slack/1082_Slack_Readbinaryfile_Create.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "Generate Excuse": {
      "main": [
        [
          {
            "node": "Merge Excuse and Mail Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Excuses File": {
      "main": [
        [
          {
            "node": "Retrieve Excuses Spreadsheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Harvey's Email": {
      "main": [
        [
          {
            "node": "Who Is The Email From?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Who Is The Email From?": {
      "main": [
        [
          {
            "node": "Read Excuses File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Excuse and Mail Data",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Slack (General)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Excuse and Mail Data": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Slack (Louis)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Excuses Spreadsheet Data": {
      "main": [
        [
          {
            "node": "Generate Excuse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
