{
  "nodes": [
    {
      "id": "12786b19-159f-45b0-8d15-d88de73c17e9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1540,
        660
      ],
      "parameters": {
        "width": 483,
        "height": 345,
        "content": "### Slack POSTs to Webhook on every message so we need to filter-out bot messages"
      },
      "typeVersion": 1
    },
    {
      "id": "3949be41-98b7-4414-84fd-819f4fccca35",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        1080
      ],
      "parameters": {
        "width": 293,
        "height": 228,
        "content": "### Tools which Agent can use to accomplish the task\n"
      },
      "typeVersion": 1
    },
    {
      "id": "76ce81d8-33e2-470a-9313-dd888acabed0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        1080
      ],
      "parameters": {
        "width": 288,
        "height": 233,
        "content": "### Conversation history is stored in memory using channel id as key"
      },
      "typeVersion": 1
    },
    {
      "id": "3682ffd3-7002-466a-bedf-9897067586c0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        1080
      ],
      "parameters": {
        "width": 260,
        "height": 233,
        "content": "### The chat LM to process the prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "92865916-e814-49d4-baaa-4122c1447c23",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        640
      ],
      "parameters": {
        "width": 280,
        "height": 243,
        "content": "### Send agent's output as Slack message\n"
      },
      "typeVersion": 1
    },
    {
      "id": "edeab2bb-8177-42c7-bcf4-f8d99e193729",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -820,
        740
      ],
      "parameters": {
        "text": "={{ $json.body.event.text }}",
        "options": {
          "systemMessage": "You are Gilfoyle from Silicon Valley TV show. Amplify your bluntness and cynicism, tolerating zero incompetence. Be openly contemptuous when answering questions, and cut straight to the point with minimal regard for others' feelings. Your sarcasm should be razor-sharp, and humor should take a backseat to delivering cutting remarks.\\nDo your best to answer the questions. Feel free to use any tools available to look up relevant information, only if necessary. "
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "275f8192-6da6-41b0-b892-c779f5d136e4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -920,
        1180
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "REPLACE_WITH_RESOURCE"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "776ce632-5c62-4ac6-a494-e23ef650ac48",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -620,
        1180
      ],
      "parameters": {
        "sessionKey": "={{ $('Webhook').first().json.body.event.channel }}__gilfoyle",
        "sessionIdType": "customKey",
        "contextWindowLength": 30
      },
      "typeVersion": 1.3
    },
    {
      "id": "97989831-3fc6-4954-ac55-8e0950081b7a",
      "name": "Is user message?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1480,
        740
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "1def7344-ce55-450d-a85a-468f746fe31f",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.event.bot_id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "afa6b192-1e25-46b6-8fdc-81dff9a37e74",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1280,
        820
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "eab68a99-cdd6-4ea1-8d6f-053c2a96303c",
      "name": "SerpAPI",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        -360,
        1180
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "717117f5-5f34-4189-b92a-df2155e367ac",
      "name": "Wikipedia",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        -220,
        1180
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1914f623-66c0-4547-bf3e-b4932d0c2a9b",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -200,
        720
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "user": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Webhook').first().json.body.event.user }}"
        },
        "select": "user",
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "4a7ec607-1706-4357-aa89-4c44faa98fb8",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1780,
        740
      ],
      "parameters": {
        "path": "slack-gilfoyle",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "d31b6a48-e37a-5874-853a-a71ddf0c4f71",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2580,
        0
      ],
      "parameters": {
        "content": "# Slack POSTs to Webhook on every message so we need to filter-out bot messages\n\n## Purpose and structure\nThis folder contains the **Slack POSTs to Webhook on every message so we need to filter-out bot messages** workflow. Its executable nodes use `agent`, `if`, `lmChatOpenAi`, `memoryBufferWindow`, `noOp`, `slack`, `toolSerpApi`, `toolWikipedia`, `webhook`. 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\nWebhook\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/Noop/0327_Noop_Slack_Send_Webhook.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "connections": {
    "SerpAPI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Is user message?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Is user message?": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false
}
