{
  "id": "n225LiEBD4QVzOsV",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Slack ToDo Bot",
  "tags": [],
  "nodes": [
    {
      "id": "5ec2bc64-70ce-4b50-98fb-62c5e7f18e31",
      "name": "Slack Trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {
          "resolveIds": true
        },
        "trigger": [
          "reaction_added"
        ],
        "watchWorkspace": true
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "ef87682d-e35c-45f1-8c35-45e6f0ef7507",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1120,
        352
      ],
      "parameters": {
        "text": "={{ $json.content }}",
        "select": "user",
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {},
      "typeVersion": 2.3
    },
    {
      "id": "608433b9-d28a-40c6-946e-872f1c9d0388",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        896,
        352
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "to_do.text[0].text.content"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5822890e-c886-42ec-985b-186ac44f7836",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        352
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "785e1374-57dc-4248-b23a-eb993faa051e",
      "name": "Filter by emoji",
      "type": "n8n-nodes-base.filter",
      "position": [
        224,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6351c136-646a-4ec0-a71f-3c1d5c6a7822",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.reaction }}",
              "rightValue": "memo"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f186bc3d-db9c-4663-95d4-f8567e5753aa",
      "name": "Get reacted message",
      "type": "n8n-nodes-base.slack",
      "position": [
        448,
        0
      ],
      "parameters": {
        "resource": "reaction",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "cachedResultName": "general"
        },
        "operation": "get",
        "timestamp": "={{ $json.item.ts }}",
        "authentication": "oAuth2"
      },
      "credentials": {},
      "typeVersion": 2.3
    },
    {
      "id": "7eb5004c-1211-4c68-abd3-ed8cde45d151",
      "name": "Added message to Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        672,
        0
      ],
      "parameters": {
        "blockUi": {
          "blockValues": [
            {
              "text": {
                "text": [
                  {
                    "text": "={{ $json.message.text }}",
                    "annotationUi": {}
                  },
                  {
                    "text": "=\n{{ $json.message.permalink }}",
                    "isLink": true,
                    "textLink": "={{ $json.message.permalink }}",
                    "annotationUi": {}
                  }
                ]
              },
              "type": "to_do",
              "richText": true
            }
          ]
        },
        "resource": "block"
      },
      "credentials": {},
      "typeVersion": 2.2
    },
    {
      "id": "685d6529-c6d8-4783-a287-1dabde7adc8b",
      "name": "Get all todos from Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        224,
        352
      ],
      "parameters": {
        "resource": "block",
        "operation": "getAll",
        "returnAll": true,
        "simplifyOutput": false,
        "fetchNestedBlocks": true
      },
      "credentials": {},
      "typeVersion": 2.2
    },
    {
      "id": "dba2cc5b-99b6-403e-b24b-a8eeb8d35e78",
      "name": "Filter todo",
      "type": "n8n-nodes-base.filter",
      "position": [
        448,
        352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0fb63b04-f3d1-419f-aec2-373132c0fc3d",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.type }}",
              "rightValue": "to_do"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "336120a6-fa0e-4207-8254-63e22499764a",
      "name": "Filter not checked todos",
      "type": "n8n-nodes-base.filter",
      "position": [
        672,
        352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d8b85f2e-f3ac-49b9-8388-5e5efe1bac1c",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.to_do.checked }}",
              "rightValue": "\"false\""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b4fb6b60-d2a0-457a-8f29-1a21076ca7f3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -176
      ],
      "parameters": {
        "width": 640,
        "height": 368,
        "content": "## Get reacted message\n\nThis is triggered by a reaction to a message, which then filters by the emoji selected and gets the final message"
      },
      "typeVersion": 1
    },
    {
      "id": "085b5cfc-adfc-4b96-bbb2-4d9441d21ee7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -176
      ],
      "parameters": {
        "width": 272,
        "height": 368,
        "content": "## Save to Notion\n\nThe message is then saved to a Notion document"
      },
      "typeVersion": 1
    },
    {
      "id": "c687d1c2-1447-4547-83af-4ad9d186db8c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        208
      ],
      "parameters": {
        "width": 448,
        "height": 368,
        "content": "## Get todos daily\n\nEvery day, this flow runs to pull the todos from the Notion document and send them as a Slack message"
      },
      "typeVersion": 1
    },
    {
      "id": "02287623-4f03-4cd5-abeb-1130a817a9b0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        208
      ],
      "parameters": {
        "width": 896,
        "height": 368,
        "content": "## Message filter\n\nSince we don't want to return all the messages, we filter them accordingly and send them to Slack"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "42a37b3a-f1fa-4b61-8fd2-4be37d7fb16e",
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter todo": {
      "main": [
        [
          {
            "node": "Filter not checked todos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "Filter by emoji",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by emoji": {
      "main": [
        [
          {
            "node": "Get reacted message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get all todos from Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get reacted message": {
      "main": [
        [
          {
            "node": "Added message to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter not checked todos": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all todos from Notion": {
      "main": [
        [
          {
            "node": "Filter todo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}