{
  "name": "Slack message to a Notion page and a ClickUp task",
  "nodes": [
    {
      "parameters": {
        "content": "## Slack message to a Notion page and a ClickUp task\n\nPortfolio demo only. This workflow is an original example for demonstration. It is not client work and it does not represent a deployment for any customer.\n\nRun **Run demo** to execute the offline rules engine. The live branch is used only when the incoming item sets `demo` to false and the placeholder credentials have been replaced.",
        "height": 220,
        "width": 520,
        "color": 4
      },
      "id": "ca595c16-4495-4c05-a7d7-0ff637458654",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -40
      ]
    },
    {
      "parameters": {},
      "id": "1276e7f5-6ed1-42a5-88ba-0e9a9db01343",
      "name": "Run demo",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        40,
        280
      ],
      "notes": "CLI and the n8n editor start here. An empty manual run loads the bundled sample.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "slack-to-notion-clickup",
        "authentication": "none",
        "responseMode": "lastNode",
        "responseData": "firstEntryJson",
        "options": {}
      },
      "id": "86c28076-ae82-4b61-8f48-4e91569bd564",
      "name": "Inbound webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        40,
        460
      ],
      "notes": "POST JSON to this path. Include demo:false only after credentials are connected.",
      "notesInFlow": true,
      "webhookId": "79a1d2e5-8610-44c3-a517-5e6ba782a49f"
    },
    {
      "parameters": {
        "trigger": [
          "message"
        ],
        "watchWorkspace": false,
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SLACK_CHANNEL_ID"
        }
      },
      "id": "60f1aecd-9e3b-472d-ba62-69ee13dbe27e",
      "name": "Slack trigger",
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        40,
        640
      ],
      "credentials": {
        "slackApi": {
          "id": "PLACEHOLDER_SLACKAPI",
          "name": "Slack bot"
        }
      },
      "notes": "Watches a channel for messages that should become tasks. Demo uses the sample message.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const sample = {\n  \"demo\": true,\n  \"text\": \"@priya Please publish the onboarding checklist\\nDue 2026-12-03. The empty state is still wrong.\",\n  \"channel\": \"#ops\",\n  \"source\": \"slack\"\n};\nconst incoming = $input.first()?.json ?? {};\nconst provided = Object.keys(incoming).filter((key) => incoming[key] !== undefined && incoming[key] !== null && incoming[key] !== '');\nconst base = provided.length ? { ...sample, ...incoming } : { ...sample };\nconst flag = incoming.demo;\nbase.demo = !(flag === false || flag === 'false' || flag === 0 || flag === '0');\nreturn [{ json: base }];\n"
      },
      "id": "f92dc07c-1315-4d45-82f4-205417446438",
      "name": "Normalize input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        340,
        360
      ],
      "notes": "Merges the request over the bundled sample. demo stays true unless the caller explicitly turns it off.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const item = $input.first().json;\nconst produced = (() => {\n\nconst text = String(item.text || item.message || '').trim();\nconst owner = (text.match(/@([a-z0-9._-]+)/i) || [])[1] || item.owner || 'unassigned';\nconst due = (text.match(/due\\s+(\\d{4}-\\d{2}-\\d{2})/i) || [])[1] || item.due || '';\nconst urgent = /urgent|asap|today|blocker|sev-?1/i.test(text);\nconst title = text.split('\\n')[0].slice(0, 100) || 'Untitled task';\nconst record = {\n  title,\n  body: text,\n  owner,\n  due,\n  priority: urgent ? 'high' : 'normal',\n  source: item.source || 'slack',\n  channel: item.channel || '',\n};\nreturn {\n  summary: 'Task for ' + owner + (due ? ' due ' + due : '') + ': ' + title,\n  route: urgent ? 'urgent' : 'normal',\n  record,\n  slackText: 'Created a Notion and ClickUp task for ' + owner + ': ' + title,\n  actions: [{ app: 'Notion and ClickUp', operation: 'create task', payload: record }],\n};\n\n})();\nif (!produced || typeof produced.summary !== 'string' || !produced.summary.trim()) {\n  throw new Error('Apply rules must return a summary string');\n}\nreturn [{\n  json: {\n    ...item,\n    ...produced,\n    demo: item.demo !== false,\n  },\n}];\n"
      },
      "id": "3c1c39a0-5172-42fc-aaf2-07a9a2483625",
      "name": "Apply rules",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        620,
        360
      ],
      "notes": "Deterministic stand-in for the model or enrichment API. Replace or precede this with a live model node when you turn demo mode off.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "fc4679d9-aa06-4f44-92bc-3046e9a12eef",
              "leftValue": "={{ $json.demo }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "937c50b1-6f76-4fdc-90b2-a65d33f45ada",
      "name": "Demo mode?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        900,
        360
      ],
      "notes": "True: package the offline result. False: run the credentialed apps.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const item = $input.first().json;\nreturn [{\n  json: {\n    demo: true,\n    status: 'demo_ready',\n    workflow: 'slack-to-notion-clickup',\n    summary: item.summary,\n    route: item.route ?? null,\n    record: item.record ?? {},\n    actions: item.actions ?? [],\n    slackText: item.slackText ?? item.summary,\n    notes: 'Demo mode did not call external apps. Send {\"demo\": false} after placeholder credentials are replaced.',\n  },\n}];\n"
      },
      "id": "c67ad0aa-031c-4dd9-9151-4eb3b757d65d",
      "name": "Package demo result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1180,
        180
      ]
    },
    {
      "parameters": {
        "authentication": "apiKey",
        "resource": "page",
        "operation": "create",
        "pageId": {
          "__rl": true,
          "mode": "url",
          "value": "https://www.notion.so/0123456789abcdef0123456789abcdef"
        },
        "title": "={{ $json.record.title || $json.summary }}",
        "blockUi": {
          "blockValues": []
        }
      },
      "id": "d3a58793-e79d-4e20-a0a0-a80e839cc46d",
      "name": "Create Notion page",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        1180,
        760
      ],
      "credentials": {
        "notionApi": {
          "id": "PLACEHOLDER_NOTIONAPI",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "resource": "task",
        "operation": "create",
        "team": "YOUR_TEAM_ID",
        "space": "YOUR_SPACE_ID",
        "folderless": true,
        "list": "YOUR_LIST_ID",
        "name": "={{ $json.record.title || $json.summary }}",
        "additionalFields": {
          "content": "={{ $json.record.body || $json.summary }}"
        }
      },
      "id": "e6ba77ac-8ba0-458f-b470-682d2826746f",
      "name": "Create ClickUp task",
      "type": "n8n-nodes-base.clickUp",
      "typeVersion": 1.1,
      "position": [
        1460,
        760
      ],
      "credentials": {
        "clickUpOAuth2Api": {
          "id": "PLACEHOLDER_CLICKUPOAUTH2API",
          "name": "ClickUp account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "#ops"
        },
        "text": "={{ $json.slackText || $json.summary }}",
        "otherOptions": {}
      },
      "id": "b5bb82a4-df60-40c6-b003-ceec2c4b2aa0",
      "name": "Post #ops",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        1740,
        760
      ],
      "credentials": {
        "slackOAuth2Api": {
          "id": "PLACEHOLDER_SLACKOAUTH2API",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {
        "content": "## Live path\n\nReplace every `PLACEHOLDER_*` credential, then POST the sample with `\"demo\": false`.\n\nThe nodes on this branch use the `record` and `actions` fields produced by Apply rules.",
        "height": 180,
        "width": 420,
        "color": 6
      },
      "id": "48d72411-2af6-43ec-8309-487712529a1f",
      "name": "Live path",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1120,
        520
      ]
    }
  ],
  "connections": {
    "Run demo": {
      "main": [
        [
          {
            "node": "Normalize input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inbound webhook": {
      "main": [
        [
          {
            "node": "Normalize input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack trigger": {
      "main": [
        [
          {
            "node": "Normalize input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize input": {
      "main": [
        [
          {
            "node": "Apply rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apply rules": {
      "main": [
        [
          {
            "node": "Demo mode?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Demo mode?": {
      "main": [
        [
          {
            "node": "Package demo result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Notion page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Notion page": {
      "main": [
        [
          {
            "node": "Create ClickUp task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create ClickUp task": {
      "main": [
        [
          {
            "node": "Post #ops",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": false,
    "description": "A Slack message with an @owner and a due date becomes both a Notion page and a ClickUp task. Urgent words raise the priority."
  },
  "active": false
}
