From 2b73e4910425e7035aa40a280b165c6b516fbc92 Mon Sep 17 00:00:00 2001 From: nusquama Date: Fri, 19 Dec 2025 05:00:51 +0100 Subject: [PATCH] creation --- .../slack_workflow_router_ai-powered_workflow_selection.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Slack Workflow Router: AI-Powered Workflow Selection-11838/slack_workflow_router_ai-powered_workflow_selection.json diff --git a/workflows/Slack Workflow Router: AI-Powered Workflow Selection-11838/slack_workflow_router_ai-powered_workflow_selection.json b/workflows/Slack Workflow Router: AI-Powered Workflow Selection-11838/slack_workflow_router_ai-powered_workflow_selection.json new file mode 100644 index 000000000..8938376f6 --- /dev/null +++ b/workflows/Slack Workflow Router: AI-Powered Workflow Selection-11838/slack_workflow_router_ai-powered_workflow_selection.json @@ -0,0 +1 @@ +{"meta":{"instanceId":"fe52080916406a2a9812a7975b2d9b9e9838f3ce0f0b34614c611fb2ca1528d3","templateCredsSetupCompleted":true},"nodes":[{"id":"405efb4e-450e-4731-a756-430d02f5f979","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[208,0],"parameters":{"text":"=Find a matching workflow for the request below. \n---\n{{ $json.blocks[0].elements[0].elements[1].text}}\n---\nIf you find a match, strictly return a valid json object like the one in the example below, with the id and the name of the workflow:\n\n{\"workflow_id\"=\"wewwet5234g3\",\"workflow_name\"=\"Name of the workflow\"}\n\nIf you do not find a match, return the following json as it is:\n\n{\"workflow_id\"=\"not_found\",\"workflow_name\"=\"not_found\"}\n\nDo not return anything else.\n","options":{"systemMessage":"You are a helpful assistant that chooses a workflow to execute based on the input coming from the user. You are given a list of workflows that consist of the following fields:\n*workflow_id: The id of the workflow\n* workflow_name: The name of the workflow.\n* workflow_description: The description of what the workflow does. \n\nThe workflows are available to you via the data table tool you have access to.\n\nYour job is to use the workflows' names and descriptions to decide which workflow matches the request coming from the user.\n\nIt is possible that none of the workflows matches with the given request."},"promptType":"define","hasOutputParser":true},"typeVersion":3},{"id":"44ad9c0f-e9a9-4ab5-9f6c-9a521cbe9992","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[176,208],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{},"builtInTools":{}},"credentials":{"openAiApi":{"id":"iAPtqcVj4gp3rRy2","name":"OpenAi account"}},"typeVersion":1.3},{"id":"0d54833b-619c-43c2-81de-6bd641f4ac49","name":"Slack Trigger","type":"n8n-nodes-base.slackTrigger","position":[-16,0],"webhookId":"4c126ca9-f1fc-4547-9651-a2f487cd30fc","parameters":{"options":{},"trigger":["app_mention"],"channelId":{"__rl":true,"mode":"id","value":"C1q1q1q1q1q"}},"credentials":{"slackApi":{"id":"tVU8HVcP92PJGgqD","name":"Slack account"}},"typeVersion":1},{"id":"3cf0e068-f652-4583-98f3-52a86674748a","name":"Get the list of workflows","type":"n8n-nodes-base.dataTableTool","position":[336,208],"parameters":{"operation":"get","returnAll":true,"dataTableId":{"__rl":true,"mode":"list","value":"jtqVNyfaCEqkptz7","cachedResultUrl":"/projects/s81lW7mqZeZcPTUl/datatables/jtqVNyfaCEqkptz7","cachedResultName":"workflows"}},"typeVersion":1},{"id":"22ddbde3-7841-48ae-844a-12e30a2fc3ab","name":"Parse JSON output","type":"n8n-nodes-base.set","position":[512,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"6a44f618-a6ea-4dc2-825a-eb8ae0982c20","name":"workflow_id","type":"string","value":"={{JSON.parse($json.output).workflow_id}}"},{"id":"8d814238-28d0-4af9-b331-66e8ad00ecf3","name":"workflow_name","type":"string","value":"={{JSON.parse($json.output).workflow_name}}"}]}},"typeVersion":3.4},{"id":"fa9ac58d-62bc-4a05-b93d-4129d54cc99d","name":"Send \"executing workflow\" message","type":"n8n-nodes-base.slack","position":[912,-96],"webhookId":"5068a5e0-6212-4778-8c5b-79dbc28af904","parameters":{"text":"=Executing workflow: {{ $json.workflow_name }} ({{ $json.workflow_id }})","select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('Slack Trigger').item.json.channel }}"},"otherOptions":{"includeLinkToWorkflow":false}},"credentials":{"slackApi":{"id":"tVU8HVcP92PJGgqD","name":"Slack account"}},"typeVersion":2.3},{"id":"0b1f7fa8-5d1b-474b-88fc-b458d5e4d2b3","name":"Is there a matching workflow?","type":"n8n-nodes-base.if","position":[704,0],"parameters":{"options":{"ignoreCase":true},"conditions":{"options":{"version":3,"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"cece972c-765c-48f1-8e72-404a6366f544","operator":{"type":"string","operation":"notContains"},"leftValue":"={{ $json.workflow_id }}","rightValue":"not_found"}]},"looseTypeValidation":true},"typeVersion":2.3},{"id":"a0f93600-1d97-4697-a0bd-f76109a993fa","name":"Send message: no workflow found","type":"n8n-nodes-base.slack","position":[912,112],"webhookId":"5068a5e0-6212-4778-8c5b-79dbc28af904","parameters":{"text":"=Sorry I could not find a workflow that matches with your request. ","select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('Slack Trigger').item.json.channel }}"},"otherOptions":{"includeLinkToWorkflow":false}},"credentials":{"slackApi":{"id":"tVU8HVcP92PJGgqD","name":"Slack account"}},"typeVersion":2.3},{"id":"a5dedada-a834-483e-9956-198c186ef5ff","name":"Send message: success","type":"n8n-nodes-base.slack","position":[1344,-176],"webhookId":"5068a5e0-6212-4778-8c5b-79dbc28af904","parameters":{"text":"Successfully executed workflow","select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('Slack Trigger').item.json.channel }}"},"otherOptions":{"includeLinkToWorkflow":false}},"credentials":{"slackApi":{"id":"tVU8HVcP92PJGgqD","name":"Slack account"}},"typeVersion":2.3},{"id":"20215f29-7454-497a-b857-6e4e45c19de5","name":"Send message: error occurred","type":"n8n-nodes-base.slack","position":[1344,16],"webhookId":"5068a5e0-6212-4778-8c5b-79dbc28af904","parameters":{"text":"An error occurred while executing the workflow","select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('Slack Trigger').item.json.channel }}"},"otherOptions":{"includeLinkToWorkflow":false}},"credentials":{"slackApi":{"id":"tVU8HVcP92PJGgqD","name":"Slack account"}},"typeVersion":2.3},{"id":"f5340679-b023-4e5b-9797-7a962c34e761","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-80,-64],"parameters":{"width":208,"height":208,"content":"Trigger on app mention"},"typeVersion":1},{"id":"1a28ad90-056f-443f-a59f-510d359bfc9b","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[304,192],"parameters":{"width":288,"height":448,"content":"\n\n\n\n\n\n\n\n\n\n\n\nCreate a data table in your project with the following 3 columns:\n* **workflow_id**: The alphanumeric id of the workflow. For example, if your workflow's url is xyz.app.n8n.cloud/workflow/sDF6oLXgxAD7O3wP/1a28ad, the id of the workflow is \"sDF6oLXgxAD7O3wP/1a28ad\"\n* **workflow_name**: Name of the workflow\n* **worklow_description**: Textual description of the workflow, what it does etc."},"typeVersion":1},{"id":"3e9601f8-2d95-4d27-8662-14a3b0e6fc39","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[176,-64],"parameters":{"width":288,"height":208,"content":"Find the workflow that matches with the description in the Slack message"},"typeVersion":1},{"id":"9629b2fd-6b63-45a5-b78b-b1d0d91ef6b6","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1072,-160],"parameters":{"width":192,"height":208,"content":"Execute the matching workflow"},"typeVersion":1},{"id":"c4c3c06d-e02a-46b5-8069-c8b048c46633","name":"Execute Workflow","type":"n8n-nodes-base.executeWorkflow","onError":"continueErrorOutput","position":[1104,-96],"parameters":{"options":{"waitForSubWorkflow":true},"workflowId":{"__rl":true,"mode":"id","value":"={{ $('Parse JSON output').item.json.workflow_id }}"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"notesInFlow":false,"typeVersion":1.3,"alwaysOutputData":true},{"id":"6d781c10-3934-457a-b8e3-383c62301b9e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-576,-208],"parameters":{"width":432,"height":976,"content":"### Slack Workflow Router: AI-Powered Workflow Selection\n\n#### Problem Statement\nSlack only allows one webhook per Slack app, and n8n generates a unique webhook for each workflow. This limitation means you typically need to create multiple Slack apps to trigger multiple n8n workflows from Slack. This workflow solves that problem by acting as a gateway for a single Slack app, enabling it to trigger multiple n8n workflows.\n\n#### How It Works\nWhen a message is received from Slack, an AI agent analyzes the message and selects the most suitable workflow to execute. The available workflows are stored in a data table, including their ID, name, and description, which the agent uses to make its decision. This approach allows you to manage and trigger multiple workflows from a single Slack app, making your Slack-to-n8n integration much more scalable and maintainable.\n\n#### Key Features\n* Trigger multiple n8n workflows from a single Slack app mention.\n* AI-powered workflow selection based on user message and workflow descriptions.\n* Centralized management of available workflows via a data table.\n* Scalable and easy to maintain—no need to create multiple Slack apps.\n\n#### Setup Instructions\n* Create a data table in your n8n project with these columns: workflow_id, workflow_name, and workflow_description.\n* Add your workflows to the table.\n* Connect your Slack and OpenAI accounts.\n* Deploy the workflow and mention your Slack app to trigger automations.\n\n\nThis template is ideal for teams who want to centralize and scale their Slack automation without creating multiple Slack apps."},"typeVersion":1}],"pinData":{},"connections":{"AI Agent":{"main":[[{"node":"Parse JSON output","type":"main","index":0}]]},"Slack Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Send message: success","type":"main","index":0}],[{"node":"Send message: error occurred","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Parse JSON output":{"main":[[{"node":"Is there a matching workflow?","type":"main","index":0}]]},"Get the list of workflows":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Is there a matching workflow?":{"main":[[{"node":"Send \"executing workflow\" message","type":"main","index":0}],[{"node":"Send message: no workflow found","type":"main","index":0}]]},"Send \"executing workflow\" message":{"main":[[{"node":"Execute Workflow","type":"main","index":0}]]}}} \ No newline at end of file