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 →
{
"name": "Discord AI Assistant Workflow (Exemplar Bot)",
"nodes": [
{
"parameters": {
"path": "/discord",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook_trigger",
"name": "Discord Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
250,
400
],
"notes": "Webhook endpoint for Discord bot DM messages"
},
{
"parameters": {
"functionCode": "// Extract payload from Discord bot\nconst payload = $input.first().json;\n\nreturn {\n userId: payload.userId,\n userName: payload.userName,\n message: payload.message,\n serverId: payload.serverId,\n mode: payload.mode || 'chat',\n timestamp: payload.timestamp,\n platform: payload.platform\n};"
},
"id": "extract_payload",
"name": "Extract Payload",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
450,
400
],
"notes": "Parse incoming Discord message data"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.mode }}",
"operation": "equals",
"value2": "code"
}
]
}
},
"id": "check_mode",
"name": "Check Mode",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
650,
400
],
"notes": "Route to different LLMs based on mode (chat vs code)"
},
{
"parameters": {
"functionCode": "// Coding Assistant with specialized LLM\n// Use GPT-4, Claude, or coding-specific model\n\nconst message = $json.message;\nconst userName = $json.userName;\nconst userId = $json.userId;\n\n// REPLACE THIS WITH YOUR CODING LLM INTEGRATION\n// Example: OpenAI with system prompt for coding\n\nconst response = `\ud83d\udd27 **Tryb kodowania aktywny**\\n\\nTwoje zapytanie: \"${message}\"\\n\\n\\`\\`\\`javascript\\n// Przyk\u0142adowa odpowied\u017a kodu\\nfunction example() {\\n return 'Tutaj powinna by\u0107 odpowied\u017a od LLM specjalizuj\u0105cego si\u0119 w kodowaniu';\\n}\\n\\`\\`\\`\\n\\nU\u017cyj OpenAI, Anthropic Claude lub innego LLM z odpowiednim system prompt dla kodowania.`;\n\nreturn {\n response: response,\n userId: userId,\n userName: userName,\n mode: 'code',\n timestamp: new Date().toISOString()\n};"
},
"id": "code_llm",
"name": "Coding LLM",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
850,
300
],
"notes": "LLM optimized for code/programming help"
},
{
"parameters": {
"functionCode": "// Chat Assistant with general LLM\n// Use GPT-3.5, GPT-4, Claude, etc.\n\nconst message = $json.message;\nconst userName = $json.userName;\nconst userId = $json.userId;\n\n// REPLACE THIS WITH YOUR CHAT LLM INTEGRATION\n// Example: OpenAI Chat Completion API\n\nlet response = '';\n\nif (message.toLowerCase().includes('help')) {\n response = `Cze\u015b\u0107 ${userName}! \ud83d\udc4b\\n\\nJestem botem AI dzia\u0142aj\u0105cym tylko w wiadomo\u015bciach prywatnych.\\n\\n**Jak mog\u0119 pom\u00f3c:**\\n\u2022 Odpowiem na Twoje pytania\\n\u2022 Udziel\u0119 informacji\\n\u2022 Pomog\u0119 z r\u00f3\u017cnymi zadaniami\\n\\n**Tryb kodowania:**\\nU\u017cyj \\`!code\\` przed wiadomo\u015bci\u0105, aby prze\u0142\u0105czy\u0107 na pomoc programistyczn\u0105.\\nPrzyk\u0142ad: \\`!code napisz funkcj\u0119 do sortowania\\``;\n} else if (message.toLowerCase().includes('hello') || message.toLowerCase().includes('cze\u015b\u0107')) {\n response = `Cze\u015b\u0107 ${userName}! Mi\u0142o Ci\u0119 pozna\u0107. W czym mog\u0119 pom\u00f3c?`;\n} else {\n // Tutaj powinna by\u0107 integracja z OpenAI/Anthropic/innym LLM\n response = `Otrzyma\u0142em Twoj\u0105 wiadomo\u015b\u0107: \"${message}\"\\n\\nZast\u0105p ten kod integracj\u0105 z prawdziwym LLM (OpenAI, Anthropic Claude, itp.)`;\n}\n\nreturn {\n response: response,\n userId: userId,\n userName: userName,\n mode: 'chat',\n timestamp: new Date().toISOString()\n};"
},
"id": "chat_llm",
"name": "Chat LLM",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
850,
500
],
"notes": "General conversational LLM"
},
{
"parameters": {
"options": {}
},
"id": "respond_webhook",
"name": "Send Response to Discord",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1050,
400
],
"notes": "Return response to Discord bot"
}
],
"connections": {
"webhook_trigger": {
"main": [
[
{
"node": "extract_payload",
"type": "main",
"index": 0
}
]
]
},
"extract_payload": {
"main": [
[
{
"node": "check_mode",
"type": "main",
"index": 0
}
]
]
},
"check_mode": {
"main": [
[
{
"node": "code_llm",
"type": "main",
"index": 0
}
],
[
{
"node": "chat_llm",
"type": "main",
"index": 0
}
]
]
},
"code_llm": {
"main": [
[
{
"node": "respond_webhook",
"type": "main",
"index": 0
}
]
]
},
"chat_llm": {
"main": [
[
{
"node": "respond_webhook",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"meta": {
"description": "Przyk\u0142adowy workflow dla bota Discord Exemplar.\n\nFunkcjonalno\u015bci:\n- Bot dzia\u0142a tylko w DM (wiadomo\u015bciach prywatnych)\n- Dwa tryby: 'chat' (domy\u015blny) i 'code' (aktywowany przez !code)\n- Routing do r\u00f3\u017cnych LLM w zale\u017cno\u015bci od trybu\n- Automatyczna moderacja (komendy /kick, /ban, /mute, /warn zarezerwowane dla automatyki)\n\nPayload structure:\n{\n userId: string,\n userName: string,\n message: string,\n serverId: string,\n mode: 'chat' | 'code',\n timestamp: ISO string,\n platform: 'discord'\n}\n\nZast\u0105p node'y 'Coding LLM' i 'Chat LLM' prawdziwymi integracjami z:\n- OpenAI (GPT-3.5, GPT-4)\n- Anthropic (Claude)\n- Lub innym LLM"
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Discord AI Assistant Workflow (Exemplar Bot). Webhook trigger; 6 nodes.
Source: https://github.com/whiteravens20/exemplar/blob/a1576114e150b35c12f954811a201854875c82fb/n8n-workflow-example.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Advanced Slackbot With N8N. Uses slack, httpRequest, stickyNote, executeWorkflow. Webhook trigger; 34 nodes.
Slackbots are super powerful. At n8n, we have been using them to get a lot done.. But it can become hard to manage and maintain many different operations that a workflow can do.
Standup Bot 4 4 Worker. Uses mattermost, httpRequest, noOp, executeWorkflow. Webhook trigger; 29 nodes.
This is the fourth workflow for the Mattermost Standup Bot. This workflow sends the team a message every morning to ask them three standup questions. What have you accomplished since your last report?
SmartPoll Automator is an n8n-powered workflow that automatically creates and publishes polls in Telegram. It helps teams, communities, and businesses run polls without manual work.