AutomationFlowsSlack & Telegram › Start Thread

Start Thread

Start_Thread. Uses executeWorkflowTrigger, httpRequest, chainLlm, lmChatOpenRouter. Event-driven trigger; 14 nodes.

Event trigger★★★★☆ complexityAI-powered14 nodesExecute Workflow TriggerHTTP RequestChain LlmOpenRouter ChatDiscord
Slack & Telegram Trigger: Event Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chainllm → Execute Workflow Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "updatedAt": "2025-12-24T08:53:16.587Z",
  "createdAt": "2025-12-23T09:30:32.352Z",
  "id": "9z0gv8DzdPC76trq",
  "name": "Start_Thread",
  "description": null,
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {
        "inputSource": "passthrough"
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        18496,
        -2320
      ],
      "id": "a929c09f-94de-42dc-a2ff-923accc5e9ab",
      "name": "ExecuteWorkflowTrigger"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://discord.com/api/v10/channels/{{ $json.ctx.event.channel_id }}/messages/{{ $json.ctx.event.message_id }}/threads",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "discordBotApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { \"name\": $json.ctx.event.clean_text.slice(0, 100) } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        18720,
        -2320
      ],
      "id": "85fce562-824f-47c1-83cf-ea4d7e807ea4",
      "name": "CreateDiscordThread",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 1000,
      "credentials": {
        "discordBotApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are an AI life coach helping the user reflect, plan, and think deeply.\n\n## Context Available\n\n**User's Guiding Principle:** {{ $json.ctx.db.north_star }}\n\nKeep this in mind when helping them, but don't mention it unless directly relevant to the conversation.\n\n## Current Situation\n\nThe user just started a conversation thread with: {{ $json.ctx.event.clean_text }}\n\nThey are coming to you for help thinking through something.\n\n## Instructions\n\n**Assess the question type:**\n\n**Simple/direct question** (what's X?, how do I Y?) \u2192 Answer directly if you can. Be concise (2-3 sentences).\n\n**Planning/reflection/decision** (what should I focus on?, help me think about X) \u2192 Signal that you're gathering context, then ask 1 clarifying question. Total 2-3 sentences.\n\n## Style\n\n- Warm and conversational\n- Natural and specific to their words\n- Not robotic or generic\n- Don't force connections to the guiding principle\n- Focus on what they're asking, not on fitting everything into a grand narrative\n\n## Example Responses (for planning/reflection questions)\n\n**User:** what should I focus on today?\n**Good response:** Let me check what you've been working on lately. Are you thinking about what to prioritize right now, or planning for the whole day?\n\n**User:** help me think through this project decision\n**Good response:** I'll look at your recent activities to give you a grounded perspective. What's the core tradeoff you're trying to navigate?\n\n**User:** feeling scattered, what's going on?\n**Good response:** Let me pull up your week so far. When did you first notice feeling scattered - today or has it been building?\n\n**User:** am I making progress on my goals?\n**Good response:** Looking at your recent work to see the patterns. Which goal are you most curious about?\n\nNotice how each response:\n1. Signals gathering context in a natural, varied way\n2. Asks a clarifying question that's conversational and specific, not generic\n\nRespond to their initial message now.",
        "needsFallback": true,
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        19616,
        -2320
      ],
      "id": "f6f390a8-c453-4cee-8d6d-2b9a415e3a29",
      "name": "GenerateInitialResponse"
    },
    {
      "parameters": {
        "model": "nvidia/nemotron-nano-9b-v2:free",
        "options": {
          "temperature": 0.7
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        19624,
        -2096
      ],
      "id": "0c6a309d-86ff-4aa3-b02f-33230ae4f092",
      "name": "NemotronNano9b",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "xiaomi/mimo-v2-flash:free",
        "options": {
          "temperature": 0.7
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        19752,
        -2096
      ],
      "id": "60963dec-c78a-4918-8b32-12e1a0f25d8b",
      "name": "MimoV2Flash",
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Prepare db_queries for trace + projection storage\nconst ctx = $json.ctx || {};\n\nconst response = ctx.llm?.completion_text || '';\nconst inferenceStart = ctx.llm?.inference_start || Date.now();\nconst durationMs = Date.now() - inferenceStart;\n\n// Build filled prompt (reconstructed from template)\nconst northStar = ctx.llm?.north_star || '(not set)';\nconst cleanText = ctx.event?.clean_text || '';\nconst promptText = `You are an AI life coach...\\n\\nUser's Guiding Principle: ${northStar}\\n\\nThe user started with: ${cleanText}`;\n\n// Prepare db_queries for Execute_Queries\nconst db_queries = [\n  {\n    key: 'trace',\n    sql: `WITH new_trace AS (\n            INSERT INTO traces (event_id, step_name, data, trace_chain)\n            VALUES ($1::uuid, 'thread_initial_response',\n              jsonb_build_object(\n                'input', jsonb_build_object('text', $2, 'thread_id', $3::text),\n                'prompt', $4,\n                'completion', $5,\n                'result', jsonb_build_object('response_length', $6::integer),\n                'model', 'nvidia/nemotron-nano-9b-v2:free',\n                'duration_ms', $7::integer\n              ), $8::uuid[])\n            RETURNING id\n          )\n          SELECT new_trace.id as trace_id, $8::uuid[] || new_trace.id as updated_trace_chain\n          FROM new_trace`,\n    params: [\n      ctx.event?.event_id,\n      cleanText,\n      ctx.thread?.id,\n      promptText,\n      response,\n      response.length,\n      durationMs,\n      ctx.event?.trace_chain || []\n    ]\n  },\n  {\n    key: 'projection',\n    sql: `INSERT INTO projections (event_id, trace_id, trace_chain, projection_type, status, data, timezone)\n          VALUES ($1::uuid, $2::uuid, $3::uuid[], 'thread_response', 'auto_confirmed',\n            jsonb_build_object(\n              'thread_id', $4,\n              'response_text', $5,\n              'role', 'assistant',\n              'timestamp', $6::timestamptz\n            ), $7)\n          RETURNING id`,\n    params: [\n      ctx.event?.event_id,\n      '$results.trace.row.trace_id',\n      '$results.trace.row.updated_trace_chain',\n      ctx.thread?.id,\n      response,\n      ctx.event?.timestamp,\n      ctx.event?.timezone\n    ]\n  }\n];\n\nreturn {\n  json: {\n    ctx: {\n      ...ctx,\n      db_queries\n    }\n  }\n};",
        "mode": "runOnceForEachItem"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        20288,
        -2320
      ],
      "id": "prepare-write-queries",
      "name": "PrepareWriteQueries"
    },
    {
      "parameters": {
        "resource": "message",
        "guildId": {
          "__rl": true,
          "value": "={{ $json.ctx.event.guild_id }}",
          "mode": "id"
        },
        "channelId": {
          "__rl": true,
          "value": "={{ $json.ctx.thread.id }}",
          "mode": "id"
        },
        "content": "={{ $json.ctx.llm.completion_text.trim().replace(/^[\"']|[\"']$/g, '') }}",
        "options": {}
      },
      "type": "n8n-nodes-base.discord",
      "typeVersion": 2,
      "position": [
        20064,
        -2320
      ],
      "id": "a5785f29-feef-42f4-8da5-d5eaeb9fd055",
      "name": "SendResponseToThread",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 1000,
      "credentials": {
        "discordBotApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "react",
        "guildId": {
          "__rl": true,
          "value": "={{ $json.ctx.event.guild_id }}",
          "mode": "id"
        },
        "channelId": {
          "__rl": true,
          "value": "={{ $json.ctx.event.channel_id }}",
          "mode": "id"
        },
        "messageId": "={{ $json.ctx.event.message_id }}",
        "emoji": "=\ud83d\udde8\ufe0f"
      },
      "type": "n8n-nodes-base.discord",
      "typeVersion": 2,
      "position": [
        18720,
        -2560
      ],
      "id": "1e7b0d2a-54ee-4607-bcd9-7872585cb7c1",
      "name": "ReactWith\ud83d\udde8\ufe0f",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 1000,
      "credentials": {
        "discordBotApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "method": "DELETE",
        "url": "=https://discord.com/api/v10/channels/{{ $json.ctx.event.channel_id }}/messages/{{ $json.ctx.event.message_id }}/reactions/\ud83d\udd35/@me",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "discordBotApi",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        18720,
        -2080
      ],
      "id": "remove-blue-reaction-start-chat",
      "name": "Remove\ud83d\udd35Reaction",
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 1000,
      "credentials": {
        "discordBotApi": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "CgUAxK0i4YhrZ2Wp",
          "mode": "list",
          "cachedResultName": "Execute_Queries",
          "cachedResultUrl": "/workflow/CgUAxK0i4YhrZ2Wp"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "ctx": "={{ $json.ctx }}"
          }
        },
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        20512,
        -2320
      ],
      "id": "execute-write-queries",
      "name": "ExecuteQueries(write)"
    },
    {
      "parameters": {
        "jsCode": "// Prepare north_star query and build initial ctx\nconst triggerData = $json;\nconst ctx = triggerData.ctx || {};\n\nconst db_queries = [\n  {\n    key: 'north_star',\n    sql: \"SELECT value FROM config WHERE key = 'north_star'\"\n  }\n];\n\nreturn {\n  json: {\n    ctx: {\n      ...ctx,\n      db_queries\n    }\n  }\n};",
        "mode": "runOnceForEachItem"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        18944,
        -2320
      ],
      "id": "prepare-read-queries",
      "name": "PrepareReadQueries"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "CgUAxK0i4YhrZ2Wp",
          "mode": "list",
          "cachedResultName": "Execute_Queries",
          "cachedResultUrl": "/workflow/CgUAxK0i4YhrZ2Wp"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "ctx": "={{ $json.ctx }}"
          }
        },
        "options": {
          "waitForSubWorkflow": true
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        19168,
        -2320
      ],
      "id": "execute-read-queries",
      "name": "ExecuteQueries(read)"
    },
    {
      "parameters": {
        "jsCode": "// Build context for LLM from thread and db results\nconst ctx = $json.ctx || {};\nconst threadData = $('CreateDiscordThread').first().json;\n\n// Get north_star from Execute_Queries result\nconst northStar = ctx.db?.north_star?.row?.value || '(not set)';\n\n// Preserve all ctx.event fields and add thread + llm context\nreturn {\n  json: {\n    ctx: {\n      event: {\n        event_id: ctx.event?.event_id,\n        channel_id: ctx.event?.channel_id,\n        message_id: ctx.event?.message_id,\n        guild_id: ctx.event?.guild_id,\n        clean_text: ctx.event?.clean_text,\n        timestamp: ctx.event?.timestamp,\n        timezone: ctx.event?.timezone,\n        trace_chain: ctx.event?.trace_chain\n      },\n      thread: {\n        id: threadData.id\n      },\n      db: {\n        north_star: northStar\n      },\n      llm: {\n        inference_start: Date.now(),\n        north_star: northStar\n      }\n    }\n  }\n};",
        "mode": "runOnceForEachItem"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        19392,
        -2320
      ],
      "id": "build-llm-context",
      "name": "BuildLlmContext"
    },
    {
      "parameters": {
        "jsCode": "// Add LLM response to ctx\nconst prevData = $('BuildLlmContext').first().json;\nconst ctx = prevData.ctx;\nconst llmResponse = $json.text || '';\n\nreturn {\n  json: {\n    ctx: {\n      ...ctx,\n      llm: {\n        ...ctx.llm,\n        completion_text: llmResponse\n      }\n    }\n  }\n};",
        "mode": "runOnceForEachItem"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        19840,
        -2320
      ],
      "id": "set-llm-response",
      "name": "SetLlmResponse"
    }
  ],
  "connections": {
    "ExecuteWorkflowTrigger": {
      "main": [
        [
          {
            "node": "CreateDiscordThread",
            "type": "main",
            "index": 0
          },
          {
            "node": "ReactWith\ud83d\udde8\ufe0f",
            "type": "main",
            "index": 0
          },
          {
            "node": "Remove\ud83d\udd35Reaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CreateDiscordThread": {
      "main": [
        [
          {
            "node": "PrepareReadQueries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PrepareReadQueries": {
      "main": [
        [
          {
            "node": "ExecuteQueries(read)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ExecuteQueries(read)": {
      "main": [
        [
          {
            "node": "BuildLlmContext",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BuildLlmContext": {
      "main": [
        [
          {
            "node": "GenerateInitialResponse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GenerateInitialResponse": {
      "main": [
        [
          {
            "node": "SetLlmResponse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SetLlmResponse": {
      "main": [
        [
          {
            "node": "SendResponseToThread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SendResponseToThread": {
      "main": [
        [
          {
            "node": "PrepareWriteQueries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PrepareWriteQueries": {
      "main": [
        [
          {
            "node": "ExecuteQueries(write)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ReactWith\ud83d\udde8\ufe0f": {
      "main": [
        []
      ]
    },
    "Remove\ud83d\udd35Reaction": {
      "main": [
        []
      ]
    },
    "NemotronNano9b": {
      "ai_languageModel": [
        [
          {
            "node": "GenerateInitialResponse",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "MimoV2Flash": {
      "ai_languageModel": [
        [
          {
            "node": "GenerateInitialResponse",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    }
  },
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "NOJ7FqVhVLqw0n8D",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": null,
  "versionId": "cf643934-0e4c-47b4-b881-746d6b5443e1",
  "activeVersionId": null,
  "versionCounter": 184,
  "triggerCount": 0,
  "shared": [
    {
      "updatedAt": "2025-12-23T09:30:32.352Z",
      "createdAt": "2025-12-23T09:30:32.352Z",
      "role": "workflow:owner",
      "workflowId": "9z0gv8DzdPC76trq",
      "projectId": "erM3nntdLL53noWi",
      "project": {
        "updatedAt": "2025-12-23T09:23:39.658Z",
        "createdAt": "2025-12-23T09:16:56.460Z",
        "id": "erM3nntdLL53noWi",
        "name": "Chris Irineo <chriskevini@gmail.com>",
        "type": "personal",
        "icon": null,
        "description": null,
        "projectRelations": [
          {
            "updatedAt": "2025-12-23T09:16:56.460Z",
            "createdAt": "2025-12-23T09:16:56.460Z",
            "userId": "2a851a2d-b7e5-4b3c-aefb-6eaaa79e0659",
            "projectId": "erM3nntdLL53noWi",
            "user": {
              "updatedAt": "2025-12-24T08:40:46.063Z",
              "createdAt": "2025-12-23T09:16:54.881Z",
              "id": "2a851a2d-b7e5-4b3c-aefb-6eaaa79e0659",
              "email": "chriskevini@gmail.com",
              "firstName": "Chris",
              "lastName": "Irineo",
              "personalizationAnswers": {
                "version": "v4",
                "personalization_survey_submitted_at": "2025-12-23T09:23:43.723Z",
                "personalization_survey_n8n_version": "1.123.5"
              },
              "settings": {
                "userActivated": true,
                "firstSuccessfulWorkflowId": "CgUAxK0i4YhrZ2Wp",
                "userActivatedAt": 1766487000077,
                "easyAIWorkflowOnboarded": true
              },
              "disabled": false,
              "mfaEnabled": false,
              "lastActiveAt": "2025-12-24",
              "isPending": false
            }
          }
        ]
      }
    }
  ],
  "tags": [],
  "activeVersion": null
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Start_Thread. Uses executeWorkflowTrigger, httpRequest, chainLlm, lmChatOpenRouter. Event-driven trigger; 14 nodes.

Source: https://github.com/chriskevini/kairon/blob/ab924f228ceb22522b9a4dfa1ab4589eb86273ad/n8n-workflows/Start_Thread.json — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

Capture_Thread. Uses executeWorkflowTrigger, chainLlm, httpRequest, discord. Event-driven trigger; 26 nodes.

Execute Workflow Trigger, Chain Llm, HTTP Request +2
Slack & Telegram

Multi_Capture. Uses executeWorkflowTrigger, httpRequest, chainLlm, lmChatOpenRouter. Event-driven trigger; 25 nodes.

Execute Workflow Trigger, HTTP Request, Chain Llm +2
Slack & Telegram

Capture_Projection. Uses executeWorkflowTrigger, httpRequest, chainLlm, lmChatOpenRouter. Event-driven trigger; 18 nodes.

Execute Workflow Trigger, HTTP Request, Chain Llm +2
Slack & Telegram

Continue_Thread. Uses executeWorkflowTrigger, chainLlm, lmChatOpenRouter, discord. Event-driven trigger; 14 nodes.

Execute Workflow Trigger, Chain Llm, OpenRouter Chat +2
Slack & Telegram

This workflow is designed for n8n users who manage multiple production workflows and want to: Receive intelligent, actionable error alerts instead of raw stack traces Understand root causes without ma

Error Trigger, Chain Llm, Gmail +5