{
  "name": "🤖 Advanced Slackbot with n8n",
  "nodes": [
    {
      "id": "8e0a3745-348b-42db-82cc-55676c897ad7",
      "name": "Start thread",
      "type": "n8n-nodes-base.slack",
      "position": [
        1260,
        180
      ]
    },
    {
      "id": "ee413d6c-dad3-4e57-b08d-ffd0f84c682e",
      "name": "send help",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        560
      ]
    },
    {
      "id": "47c146f9-1223-46a7-bfd6-0fa6ff701efe",
      "name": "Validate Slack token",
      "type": "n8n-nodes-base.if",
      "position": [
        320,
        280
      ]
    },
    {
      "id": "7733505c-d02c-4cb2-be78-f2272e5b7d6e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -140
      ],
      "parameters": {
        "width": 549.1826144791862,
        "height": 326.46772464213774,
        "content": "## 👨‍🎤 Setup\n1. Add Slack command and point it up to the webhook\n2. Add the following to the **Set config** node\n- `alerts_channel` with alerts channel to start threads on\n- `instance_url` with this i"
      }
    },
    {
      "id": "30355072-5d75-4deb-af67-909ba59e6eb3",
      "name": "Reply to user that command was received",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        40
      ]
    },
    {
      "id": "a2217c45-700e-4923-96e4-455a733bc1e4",
      "name": "if has workflow",
      "type": "n8n-nodes-base.if",
      "position": [
        740,
        280
      ]
    },
    {
      "id": "7ff12aa4-680f-42af-aa2f-c9dd6a733976",
      "name": "Set config",
      "type": "n8n-nodes-base.set",
      "position": [
        -100,
        280
      ]
    },
    {
      "id": "4c730be9-d3f5-45ee-8f2b-b6bfd685ea78",
      "name": "Send debug url",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        440
      ]
    },
    {
      "id": "f4ccc237-d703-4963-8112-cc38ae9d6b2a",
      "name": "if create thread",
      "type": "n8n-nodes-base.if",
      "position": [
        980,
        280
      ]
    },
    {
      "id": "ed9f2ed8-5266-42a3-9d47-621050e5bf97",
      "name": "Alert user that thread was created",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        0
      ]
    },
    {
      "id": "9904180a-e937-43fd-9b04-627e860d693a",
      "name": "Add debug info",
      "type": "n8n-nodes-base.slack",
      "position": [
        1540,
        60
      ]
    },
    {
      "id": "6b385f75-4ebf-46c8-a799-babdb6231f4e",
      "name": "Execute target workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1940,
        500
      ]
    },
    {
      "id": "5fde8d57-6ef3-4b01-9422-16fd2f176c5d",
      "name": "Add thread info",
      "type": "n8n-nodes-base.merge",
      "position": [
        1760,
        320
      ]
    },
    {
      "id": "c4892e34-53af-4d95-a3b6-ca16fdef1aa7",
      "name": "Handle other commands",
      "type": "n8n-nodes-base.switch",
      "position": [
        640,
        620
      ]
    },
    {
      "id": "7dabe06a-8d87-4e68-b8d9-53bf7f29a9ab",
      "name": "Set thread info",
      "type": "n8n-nodes-base.set",
      "position": [
        1540,
        240
      ]
    },
    {
      "id": "e56875c4-ce2b-4639-aabc-21f1562a3858",
      "name": "Unknown command",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        740
      ]
    },
    {
      "id": "3fab88ce-4a80-483b-b558-12e111f16c98",
      "name": "Set vars",
      "type": "n8n-nodes-base.set",
      "position": [
        -280,
        280
      ]
    },
    {
      "id": "99cab485-4099-4505-9c9e-33ea389818e5",
      "name": "Webhook to call for Slack command",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -480,
        280
      ]
    },
    {
      "id": "09dc7ecf-a577-427e-a193-ed29d260c5fe",
      "name": "Reply to user directly",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        900
      ]
    },
    {
      "id": "a38b3343-8e8e-4d6c-95ef-66efafdfa913",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        660
      ],
      "parameters": {
        "width": 1255.4495374151727,
        "height": 655.2393233866135,
        "content": "## Example subworkflow for command WITHOUT Slack thread..\n\n### Build this in a separate workflow\n### and add the id to `commands` in **Set Config**"
      }
    },
    {
      "id": "87f764b3-135c-4dc3-8633-b58e2c3a4e2d",
      "name": "Command workflow trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1220,
        1020
      ]
    },
    {
      "id": "3a52d7e3-ef56-47db-844a-1efb6c20ad35",
      "name": "if has flag",
      "type": "n8n-nodes-base.if",
      "position": [
        1400,
        1120
      ]
    },
    {
      "id": "78718555-e266-4f58-ab9d-6e78f50afac2",
      "name": "If matches env variable",
      "type": "n8n-nodes-base.if",
      "position": [
        1620,
        1120
      ]
    },
    {
      "id": "0ca15a51-2e56-4ef4-8be6-96f45ed17867",
      "name": "Found user",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2220,
        1120
      ]
    },
    {
      "id": "ad83305f-9ca5-428f-a731-9afe3a82258a",
      "name": "Format data into nice structure",
      "type": "n8n-nodes-base.code",
      "position": [
        2040,
        1120
      ]
    },
    {
      "id": "6bdbd120-68ac-46ad-bd34-c43d7a447be4",
      "name": "REPLACE ME WITH TRIGGER",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        1680
      ]
    },
    {
      "id": "e2b0b88d-be4a-4b66-be15-3e8c6052d0f7",
      "name": "Delete user here for example",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1500,
        1800
      ]
    },
    {
      "id": "b0dc9a07-4957-4643-972b-49952d6fc001",
      "name": "Get user here for example",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1840,
        1120
      ]
    },
    {
      "id": "1f2eff56-a89b-4d6d-af8b-477c81c8bab3",
      "name": "Confirm user was deleted",
      "type": "n8n-nodes-base.slack",
      "position": [
        1720,
        1800
      ]
    },
    {
      "id": "0c0d0487-a594-4e88-b777-21b4816115cd",
      "name": "Replying to thread",
      "type": "n8n-nodes-base.slack",
      "position": [
        1500,
        1580
      ]
    },
    {
      "id": "2c055ef4-4c0a-475d-b521-30002a45950b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        1380
      ],
      "parameters": {
        "width": 961.7738517807816,
        "height": 589.0078772779973,
        "content": "## Example subworkflow for command WITH Slack thread..\n\n### Build this in a second separate workflow\n### and add the id to `commands` in **Set Config**\n\nUsed Edit Fields node here as trigger because y"
      }
    },
    {
      "id": "aec1b842-1219-4367-9238-3c7a118ce68f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        460
      ],
      "parameters": {
        "width": 150,
        "height": 83.26656725254155,
        "content": "### 👆🏽 Set all custom config here "
      }
    },
    {
      "id": "dd8f1a00-dfd4-4966-a76c-3c8e2a243bab",
      "name": "parse command",
      "type": "n8n-nodes-base.code",
      "position": [
        560,
        280
      ]
    },
    {
      "id": "22b8502c-dec3-4456-9947-639761517881",
      "name": "Validate webhook signature",
      "type": "n8n-nodes-base.code",
      "position": [
        100,
        280
      ]
    }
  ],
  "connections": {
    "Set vars": {
      "main": [
        [
          {
            "node": "Set config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set config": {
      "main": [
        [
          {
            "node": "Validate webhook signature",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if has flag": {
      "main": [
        [
          {
            "node": "If matches env variable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start thread": {
      "main": [
        [
          {
            "node": "Add debug info",
            "type": "main",
            "index": 0
          },
          {
            "node": "Set thread info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse command": {
      "main": [
        [
          {
            "node": "if has workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add thread info": {
      "main": [
        [
          {
            "node": "Execute target workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set thread info": {
      "main": [
        [
          {
            "node": "Add thread info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if has workflow": {
      "main": [
        [
          {
            "node": "if create thread",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle other commands",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "if create thread": {
      "main": [
        [
          {
            "node": "Start thread",
            "type": "main",
            "index": 0
          },
          {
            "node": "Alert user that thread was created",
            "type": "main",
            "index": 0
          },
          {
            "node": "Add thread info",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Send debug url",
            "type": "main",
            "index": 0
          },
          {
            "node": "Execute target workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Slack token": {
      "main": [
        [
          {
            "node": "Reply to user that command was received",
            "type": "main",
            "index": 0
          },
          {
            "node": "parse command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Handle other commands": {
      "main": [
        [
          {
            "node": "send help",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Unknown command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If matches env variable": {
      "main": [
        [
          {
            "node": "Get user here for example",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "REPLACE ME WITH TRIGGER": {
      "main": [
        [
          {
            "node": "Replying to thread",
            "type": "main",
            "index": 0
          },
          {
            "node": "Delete user here for example",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command workflow trigger": {
      "main": [
        [
          {
            "node": "Reply to user directly",
            "type": "main",
            "index": 0
          },
          {
            "node": "if has flag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get user here for example": {
      "main": [
        [
          {
            "node": "Format data into nice structure",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate webhook signature": {
      "main": [
        [
          {
            "node": "Validate Slack token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete user here for example": {
      "main": [
        [
          {
            "node": "Confirm user was deleted",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format data into nice structure": {
      "main": [
        [
          {
            "node": "Found user",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook to call for Slack command": {
      "main": [
        [
          {
            "node": "Set vars",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}