{
  "meta": {
    "site": "https://github.com/zengfr/n8n-workflow-all-templates",
    "name": "Search Slack for n8n templates with OpenAI tips, Google Sheets cache and weekly analytics",
    "wechat": "youandme10086",
    "id": 13195,
    "update_time": "2026-02-13"
  },
  "nodes": [
    {
      "id": "66e219b9-b9c9-4c0f-8f1c-673cdfd73025",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        480
      ],
      "parameters": {
        "width": 560,
        "height": 796,
        "content": "# n8n Template Search Bot for Slack (Enhanced)\n\nA smart Slack bot that searches the official n8n template library, provides **AI-powered tips & suggestions**, caches results, and logs analytics.\n\n### Features\n- Search 200+ service names with Japanese-to-English mapping\n- AI-powered tips & improvement suggestions for each query\n- Google Sheets cache to avoid repeated API calls\n- Analytics logging for search history\n- Smart error handling with fallback suggestions\n- Intent detection: search vs help vs categories\n\n### How it works\n1. **Trigger:** User @mentions the bot in Slack\n2. **Intent Detection:** Classify as search, help, or categories\n3. **Cache Check:** Look for recent identical searches\n4. **Search:** Query the n8n Templates API\n5. **AI Tips:** Generate contextual improvement suggestions\n6. **Reply:** Send formatted results + tips back to Slack\n7. **Log:** Save search analytics to Google Sheets\n\n### Setup\n1. Create a Slack App with `app_mentions:read` and `chat:write` scopes\n2. Set your Slack credentials and OpenAI API key in n8n\n3. Create a Google Sheet with two tabs: Cache (SearchQuery, CachedResponse, ResultCount, Timestamp) and Analytics (Timestamp, User, Query, Keywords, ResultCount, Intent, FromCache)\n4. Configure the channel ID and Sheet ID in the nodes\n5. Activate the workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "b4a600aa-8a7d-4408-894f-f0b73ba13cbf",
      "name": "Sticky Note - Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        480
      ],
      "parameters": {
        "color": 7,
        "height": 576,
        "content": "## Trigger\nListens for `@bot` mentions in the configured Slack channel."
      },
      "typeVersion": 1
    },
    {
      "id": "6e44adf0-7969-4716-8f43-31f282cc00f4",
      "name": "Sticky Note - Normalize",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2352,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 576,
        "content": "## Normalize, Extract & Detect Intent\nDetects 200+ tool/service names, translates 150+ Japanese terms, and classifies intent (search / help / categories)."
      },
      "typeVersion": 1
    },
    {
      "id": "c4895ce6-e687-49b9-ad38-bded625e1685",
      "name": "Sticky Note - Intent Router",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2864,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 576,
        "content": "## Intent Router\nRoutes the message based on detected intent:\n- **search** > Cache check > API > AI Tips\n- **help** > Direct help response\n- **categories** > Show popular categories"
      },
      "typeVersion": 1
    },
    {
      "id": "04a0c158-4d41-4801-860f-a6badc71f7af",
      "name": "Sticky Note - Cache",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3216,
        480
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 560,
        "content": "## Cache Layer\nChecks Google Sheets for recent identical searches to avoid redundant API calls."
      },
      "typeVersion": 1
    },
    {
      "id": "e9b33ce0-54b7-421e-9bd3-4d089a6d9fbc",
      "name": "Sticky Note - Search & AI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3552,
        480
      ],
      "parameters": {
        "color": 6,
        "width": 540,
        "height": 560,
        "content": "## Search + AI Tips\nQueries the n8n Templates API, then uses OpenAI to generate contextual tips and improvement ideas based on what the user is trying to build."
      },
      "typeVersion": 1
    },
    {
      "id": "458babca-4a03-47e4-ac71-2a3cab9fcbc4",
      "name": "Sticky Note - Reply & Log",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4128,
        480
      ],
      "parameters": {
        "color": 3,
        "width": 480,
        "height": 560,
        "content": "## Format, Reply & Log\nFormats results with tips into Slack message, replies in thread, and logs the search to Google Sheets for analytics."
      },
      "typeVersion": 1
    },
    {
      "id": "589b04f2-b4d6-4c57-9959-d62117fc351a",
      "name": "Sticky Note - Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3552,
        1104
      ],
      "parameters": {
        "color": 2,
        "width": 400,
        "height": 260,
        "content": "## Error Handling\nCatches any errors in the workflow and sends a friendly error message to the Slack thread so the user isn't left hanging."
      },
      "typeVersion": 1
    },
    {
      "id": "f37da460-ffa2-40c3-979c-0cd583e0d437",
      "name": "Slack Trigger - Bot Mention",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        2128,
        672
      ],
      "parameters": {
        "options": {},
        "trigger": [
          "app_mention"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a channel..."
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b9a1fd51-7589-44fc-86af-eb3c3cfb5237",
      "name": "Extract Keywords & Detect Intent",
      "type": "n8n-nodes-base.code",
      "position": [
        2384,
        672
      ],
      "parameters": {
        "jsCode": "const event = $input.first().json.event || $input.first().json;\nconst rawText = event.text || '';\nconst userRequest = rawText.replace(/<@[^>]+>\\s*/g, '').trim();\nconst userId = event.user || 'unknown';\n\n// \u2500\u2500 Intent Detection \u2500\u2500\nconst helpPatterns = /^(help|ayuda|\u30d8\u30eb\u30d7|\u4f7f\u3044\u65b9|how to use|como usar|how does|que puedo)/i;\nconst categoryPatterns = /^(categories|categor\u00edas|\u30ab\u30c6\u30b4\u30ea|list|show me|popular|trending|\u4eba\u6c17)/i;\n\nlet intent = 'search';\nif (helpPatterns.test(userRequest)) intent = 'help';\nelse if (categoryPatterns.test(userRequest)) intent = 'categories';\n\n// \u2500\u2500 Known service & tool names (200+) \u2500\u2500\nconst knownServices = [\n  'Claude','OpenAI','GPT','ChatGPT','GPT-4','GPT-3','Anthropic','Gemini','Bard',\n  'Llama','Mistral','Cohere','Perplexity','Copilot','Midjourney','DALL-E','Stable Diffusion',\n  'Hugging Face','LangChain','Pinecone','Weaviate','Qdrant','ChromaDB',\n  'LINE','Slack','Discord','Telegram','WhatsApp','Messenger','WeChat',\n  'Microsoft Teams','Teams','Zoom','Webex','Google Chat','Mattermost','Rocket.Chat',\n  'Gmail','Outlook','Yahoo Mail','SendGrid','Mailchimp','Mailgun','Postmark',\n  'Amazon SES','SMTP','IMAP','Sendinblue','ConvertKit','ActiveCampaign',\n  'Google Sheets','Excel','Airtable','Notion','Coda','Smartsheet',\n  'MySQL','PostgreSQL','Postgres','MongoDB','Redis','SQLite','MariaDB',\n  'Supabase','Firebase','Firestore','DynamoDB','Fauna','PlanetScale','Neon',\n  'Snowflake','BigQuery','Redshift','Elasticsearch','Algolia','Meilisearch',\n  'Salesforce','HubSpot','Pipedrive','Zoho','Zendesk','Freshdesk','Intercom',\n  'Monday','Close','Copper','Insightly','Keap','Agile CRM',\n  'Jira','Trello','Asana','Basecamp','ClickUp','Linear','Todoist',\n  'Monday.com','Wrike','Teamwork','Shortcut','Height','Hive',\n  'GitHub','GitLab','Bitbucket','Jenkins','CircleCI','Travis CI',\n  'Docker','Kubernetes','Terraform','Ansible','Vercel','Netlify','Heroku',\n  'Sentry','Datadog','New Relic','PagerDuty','Opsgenie','Grafana','Prometheus',\n  'AWS','Amazon','S3','Lambda','EC2','SQS','SNS','CloudWatch',\n  'Azure','Google Cloud','GCP','Cloud Functions','Cloud Run',\n  'Cloudflare','DigitalOcean','Linode','Vultr',\n  'Shopify','WooCommerce','Magento','BigCommerce','Squarespace',\n  'Stripe','PayPal','Square','Braintree','Adyen','Razorpay','Paddle',\n  'Twitter','X','Facebook','Instagram','LinkedIn','TikTok','YouTube',\n  'Pinterest','Reddit','Threads','Mastodon','Bluesky',\n  'Google Ads','Facebook Ads','Google Analytics','Mixpanel','Amplitude','Segment',\n  'Buffer','Hootsuite','Sprout Social','Later','Canva',\n  'Google Drive','Dropbox','OneDrive','Box','iCloud',\n  'Google Docs','Microsoft Word','Confluence','Slite',\n  'DocuSign','HelloSign','PandaDoc','Adobe Sign',\n  'Google Meet','Whereby','Loom','Vidyard','Vimeo','Wistia','Mux',\n  'Google Calendar','Outlook Calendar','Calendly','Cal.com','Acuity',\n  'Doodle','SavvyCal','Reclaim',\n  'Google Forms','Typeform','JotForm','Tally','SurveyMonkey',\n  'QuickBooks','Xero','FreshBooks','Wave','Zoho Books',\n  'Harvest','Toggl','Clockify',\n  'Workday','BambooHR','Gusto','Rippling','Deel',\n  'Greenhouse','Lever','Workable','Breezy HR','JazzHR',\n  'Zapier','Make','Integromat','IFTTT','Workato','Tray.io',\n  'Twilio','Vonage','Plivo','MessageBird',\n  'Webflow','WordPress','Ghost','Contentful','Strapi','Sanity',\n  'Figma','Sketch','Adobe XD','InVision','Framer',\n  'RSS','Webhook','HTTP','API','REST','GraphQL','gRPC',\n  'Cron','Schedule','Timer','Trigger',\n  'PDF','CSV','JSON','XML','YAML','Markdown',\n  'OCR','QR','Barcode','Image','Video','Audio',\n  'AI','Bot','Chatbot','Automation','Workflow','RPA','Scraping'\n];\n\n// \u2500\u2500 Japanese-to-English keyword mapping (150+) \u2500\u2500\nconst jaToEn = {\n  '\u8acb\u6c42\u66f8':'invoice billing','\u898b\u7a4d\u66f8':'quote estimate','\u5951\u7d04\u66f8':'contract agreement',\n  '\u9818\u53ce\u66f8':'receipt','\u7d0d\u54c1\u66f8':'delivery slip','\u767a\u6ce8\u66f8':'purchase order',\n  '\u5831\u544a\u66f8':'report','\u8b70\u4e8b\u9332':'meeting minutes notes','\u63d0\u6848\u66f8':'proposal',\n  '\u4f01\u753b\u66f8':'proposal plan','\u4ed5\u69d8\u66f8':'specification','\u30de\u30cb\u30e5\u30a2\u30eb':'manual documentation',\n  '\u7533\u8acb\u66f8':'application form','\u7a1f\u8b70':'approval workflow','\u7d4c\u8cbb':'expense',\n  '\u9867\u5ba2':'customer client CRM','\u58f2\u4e0a':'sales revenue','\u5728\u5eab':'inventory stock',\n  '\u4e88\u7d04':'booking reservation appointment','\u6ce8\u6587':'order purchase',\n  '\u554f\u3044\u5408\u308f\u305b':'inquiry contact support ticket','\u30b5\u30dd\u30fc\u30c8':'support helpdesk',\n  '\u30ea\u30fc\u30c9':'lead prospect','\u5546\u8ac7':'deal opportunity sales','\u30bf\u30b9\u30af':'task todo',\n  '\u30d7\u30ed\u30b8\u30a7\u30af\u30c8':'project','\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb':'schedule calendar','\u9032\u6357':'progress status',\n  '\u6848\u4ef6':'deal project case','\u898b\u8fbc\u307f\u5ba2':'prospect lead','\u53d7\u6ce8':'order received',\n  '\u767a\u6ce8':'purchase order','\u5165\u91d1':'payment received','\u51fa\u91d1':'payment expense',\n  '\u81ea\u52d5\u5316':'automation automate','\u9023\u643a':'integration connect sync',\n  '\u540c\u671f':'sync synchronize','\u901a\u77e5':'notification alert notify',\n  '\u9001\u4fe1':'send post','\u53d7\u4fe1':'receive get','\u8ee2\u9001':'forward',\n  '\u4f5c\u6210':'create generate new','\u66f4\u65b0':'update edit modify','\u524a\u9664':'delete remove',\n  '\u53d6\u5f97':'fetch get retrieve','\u5909\u63db':'convert transform','\u62bd\u51fa':'extract parse',\n  '\u96c6\u8a08':'aggregate sum total','\u5206\u6790':'analyze analytics','\u8981\u7d04':'summarize summary',\n  '\u7ffb\u8a33':'translate translation','\u627f\u8a8d':'approve approval workflow',\n  '\u30d0\u30c3\u30af\u30a2\u30c3\u30d7':'backup','\u30b3\u30d4\u30fc':'copy duplicate','\u79fb\u52d5':'move transfer',\n  '\u30a4\u30f3\u30dd\u30fc\u30c8':'import','\u30a8\u30af\u30b9\u30dd\u30fc\u30c8':'export','\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9':'download',\n  '\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9':'upload','\u691c\u7d22':'search find','\u30d5\u30a3\u30eb\u30bf\u30fc':'filter',\n  '\u4e26\u3079\u66ff\u3048':'sort order','\u30b0\u30eb\u30fc\u30d7\u5316':'group aggregate',\n  '\u30e1\u30fc\u30eb':'email mail','\u30c1\u30e3\u30c3\u30c8':'chat message','\u30dc\u30c3\u30c8':'bot chatbot',\n  '\u30e1\u30c3\u30bb\u30fc\u30b8':'message notification','\u8fd4\u4fe1':'reply response',\n  '\u30d5\u30a9\u30fc\u30e0':'form','\u30a2\u30f3\u30b1\u30fc\u30c8':'survey questionnaire','\u30d5\u30a3\u30fc\u30c9\u30d0\u30c3\u30af':'feedback',\n  '\u554f\u5408\u305b':'contact inquiry','\u304a\u77e5\u3089\u305b':'announcement notification',\n  '\u30ea\u30de\u30a4\u30f3\u30c9':'reminder notification','\u30d5\u30a9\u30ed\u30fc\u30a2\u30c3\u30d7':'followup',\n  '\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8':'spreadsheet Google Sheets','\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9':'database',\n  '\u753b\u50cf':'image photo','\u5199\u771f':'photo image','\u30d5\u30a1\u30a4\u30eb':'file document',\n  '\u30d5\u30a9\u30eb\u30c0':'folder directory','\u6dfb\u4ed8':'attachment','\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8':'document',\n  '\u30c6\u30fc\u30d6\u30eb':'table database','\u30ec\u30b3\u30fc\u30c9':'record row','\u30ab\u30e9\u30e0':'column field',\n  'SNS':'social media','\u6295\u7a3f':'post publish tweet','\u30d5\u30a9\u30ed\u30ef\u30fc':'follower',\n  '\u3044\u3044\u306d':'like favorite','\u30b7\u30a7\u30a2':'share retweet','\u30b3\u30e1\u30f3\u30c8':'comment reply',\n  '\u30ad\u30e3\u30f3\u30da\u30fc\u30f3':'campaign marketing','\u30cb\u30e5\u30fc\u30b9\u30ec\u30bf\u30fc':'newsletter email',\n  '\u30e1\u30eb\u30de\u30ac':'newsletter email marketing','\u5e83\u544a':'ads advertising',\n  'LP':'landing page','\u30e9\u30f3\u30c7\u30a3\u30f3\u30b0\u30da\u30fc\u30b8':'landing page',\n  '\u6c7a\u6e08':'payment checkout','\u652f\u6255\u3044':'payment billing','\u8acb\u6c42':'billing invoice',\n  '\u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3':'subscription recurring','\u30ab\u30fc\u30c8':'cart checkout ecommerce',\n  '\u5546\u54c1':'product item','\u4fa1\u683c':'price','\u5272\u5f15':'discount coupon',\n  '\u30af\u30fc\u30dd\u30f3':'coupon discount','\u914d\u9001':'shipping delivery','\u8fd4\u54c1':'return refund',\n  '\u52e4\u6020':'attendance timesheet','\u7d66\u4e0e':'payroll salary','\u63a1\u7528':'recruitment hiring',\n  '\u9762\u63a5':'interview','\u5fdc\u52df':'application candidate','\u5f93\u696d\u54e1':'employee staff',\n  '\u4f11\u6687':'leave vacation PTO','\u30b7\u30d5\u30c8':'shift schedule',\n  '\u4f1a\u8b70':'meeting calendar','\u30df\u30fc\u30c6\u30a3\u30f3\u30b0':'meeting call','\u4e88\u5b9a':'schedule event',\n  '\u30a4\u30d9\u30f3\u30c8':'event','\u30a6\u30a7\u30d3\u30ca\u30fc':'webinar','\u53c2\u52a0\u8005':'attendee participant',\n  '\u62db\u5f85':'invite invitation','\u51fa\u6b20':'RSVP attendance',\n  '\u30a8\u30e9\u30fc':'error bug','\u30d0\u30b0':'bug issue','\u30c7\u30d7\u30ed\u30a4':'deploy release',\n  '\u30ea\u30ea\u30fc\u30b9':'release deploy','\u30c6\u30b9\u30c8':'test QA','\u30ec\u30d3\u30e5\u30fc':'review',\n  '\u30b3\u30fc\u30c9':'code','\u30d7\u30eb\u30ea\u30af\u30a8\u30b9\u30c8':'pull request PR','\u30de\u30fc\u30b8':'merge',\n  '\u30d3\u30eb\u30c9':'build CI','\u30a2\u30e9\u30fc\u30c8':'alert monitoring','\u76e3\u8996':'monitoring',\n  '\u5929\u6c17':'weather forecast','\u30cb\u30e5\u30fc\u30b9':'news RSS feed','\u682a\u4fa1':'stock price finance',\n  '\u30ab\u30ec\u30f3\u30c0\u30fc':'calendar schedule','\u30ea\u30de\u30a4\u30f3\u30c0\u30fc':'reminder notification',\n  '\u30ed\u30b0':'log record','\u5c65\u6b74':'history log',\n  '\u5b9a\u671f':'scheduled recurring cron','\u65e5\u6b21':'daily schedule','\u9031\u6b21':'weekly',\n  '\u6708\u6b21':'monthly','\u30ec\u30dd\u30fc\u30c8':'report analytics','\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9':'dashboard',\n  '\u30e1\u30cb\u30e5\u30fc':'menu list options','\u30ec\u30b9\u30c8\u30e9\u30f3':'restaurant food','\u6599\u7406':'cooking recipe food',\n  '\u98f2\u98df':'restaurant food service','\u4e88\u7b97':'budget finance','\u30b3\u30b9\u30c8':'cost expense'\n};\n\n// \u2500\u2500 Keyword extraction \u2500\u2500\nconst foundKeywords = new Set();\nconst lowerText = userRequest.toLowerCase();\n\nfor (const service of knownServices) {\n  if (lowerText.includes(service.toLowerCase())) {\n    foundKeywords.add(service);\n  }\n}\n\nfor (const [ja, en] of Object.entries(jaToEn)) {\n  if (userRequest.includes(ja)) {\n    en.split(' ').forEach(word => foundKeywords.add(word));\n  }\n}\n\nconst keywords = Array.from(foundKeywords);\nconst searchQuery = keywords.length > 0\n  ? keywords.slice(0, 8).join(' ')\n  : userRequest;\n\nreturn [{\n  json: {\n    channel: event.channel,\n    threadTs: event.thread_ts || event.ts,\n    userId,\n    userRequest,\n    searchQuery,\n    intent,\n    keywordsFound: keywords,\n    timestamp: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "d7a74f99-86e7-4b59-a579-b68fdd810b5c",
      "name": "Route by Intent",
      "type": "n8n-nodes-base.switch",
      "position": [
        2896,
        672
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.intent }}",
                    "rightValue": "search"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.intent }}",
                    "rightValue": "help"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true
                },
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.intent }}",
                    "rightValue": "categories"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2121a1a9-a862-4e75-a8bd-7a0bc148b4cd",
      "name": "Generate Help Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3248,
        848
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nconst text = '*Hola! Soy el bot de busqueda de templates de n8n.*\\n\\n' +\n  'Puedo ayudarte a encontrar workflows pre-hechos para automatizar tu trabajo.\\n\\n' +\n  '*Como usarme?*\\n' +\n  '- Menciname + lo que necesitas: `@bot Slack + Google Sheets`\\n' +\n  '- Puedo entender nombres de servicios como Gmail, Notion, Stripe, etc.\\n' +\n  '- Tambien entiendo japones: `@bot invoice automation`\\n\\n' +\n  '*Comandos especiales:*\\n' +\n  '- `@bot categories` - Ver categorias populares\\n' +\n  '- `@bot help` - Este mensaje\\n\\n' +\n  '*Ejemplos:*\\n' +\n  '- `@bot email automation with Gmail`\\n' +\n  '- `@bot Shopify inventory management`\\n' +\n  '- `@bot menu para restaurante`\\n' +\n  '- `@bot CRM lead tracking`\\n\\n' +\n  'Preguntame lo que necesites!';\n\nreturn [{ json: { ...data, text, resultCount: 0, fromCache: false } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "b0c77ce9-3c51-4bb1-82df-81a1b210c405",
      "name": "Generate Categories Response",
      "type": "n8n-nodes-base.code",
      "position": [
        3248,
        1008
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nconst text = '*Categorias populares de templates n8n:*\\n\\n' +\n  '*AI & LLM:* ChatGPT, Claude, Gemini, AI agents\\n' +\n  '*Email:* Gmail automation, email parsing, newsletters\\n' +\n  '*Chat & Messaging:* Slack bots, Telegram, Discord\\n' +\n  '*Data & Spreadsheets:* Google Sheets, Airtable, databases\\n' +\n  '*eCommerce:* Shopify, Stripe, inventory management\\n' +\n  '*Social Media:* Twitter/X, LinkedIn, Instagram posting\\n' +\n  '*DevOps:* GitHub, CI/CD, monitoring, alerts\\n' +\n  '*Project Management:* Jira, Trello, Asana, Notion\\n' +\n  '*CRM & Sales:* HubSpot, Salesforce, lead management\\n' +\n  '*Documents:* PDF generation, contracts, invoices\\n\\n' +\n  '_Menciname con cualquier termino para buscar templates especificos._';\n\nreturn [{ json: { ...data, text, resultCount: 0, fromCache: false } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "7e923edf-ee41-47f0-9d28-bde14673a861",
      "name": "Check Cache - Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3248,
        672
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Cache"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a spreadsheet..."
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "0d725409-069e-4112-9cfd-97bf96e0e7e4",
      "name": "Cache Hit?",
      "type": "n8n-nodes-base.if",
      "position": [
        3488,
        672
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "exists"
              },
              "leftValue": "={{ $json.SearchQuery }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "33fecaff-7c24-4258-9080-492bf4c38555",
      "name": "Use Cached Result",
      "type": "n8n-nodes-base.code",
      "position": [
        3728,
        576
      ],
      "parameters": {
        "jsCode": "const cached = $input.first().json;\nconst slackData = $('Extract Keywords & Detect Intent').first().json;\n\nreturn [{\n  json: {\n    ...slackData,\n    text: cached.CachedResponse || 'No cached data found.',\n    resultCount: parseInt(cached.ResultCount || '0'),\n    fromCache: true\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "8ac341d7-5e1d-4c38-8eab-ed45ffced95b",
      "name": "Search n8n Templates API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3728,
        752
      ],
      "parameters": {
        "url": "https://api.n8n.io/templates/search",
        "options": {
          "timeout": 30000
        },
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "search",
              "value": "={{ $('Extract Keywords & Detect Intent').first().json.searchQuery }}"
            },
            {
              "name": "rows",
              "value": "5"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d4a54b06-bf4b-4863-a101-f69434634c47",
      "name": "Has Results?",
      "type": "n8n-nodes-base.if",
      "position": [
        3952,
        752
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ ($json.workflows || []).length }}",
              "rightValue": "0"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b4fd11b9-39a0-4743-852c-0f2244ef6bae",
      "name": "AI Generate Tips & Suggestions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4176,
        672
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "POST",
        "options": {
          "timeout": 60000
        },
        "jsonBody": "={\n  \"model\": \"gpt-4o-mini\",\n  \"max_tokens\": 500,\n  \"temperature\": 0.7,\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are an n8n automation expert assistant. The user asked about a workflow topic. Based on the search results found, provide 3-5 short, actionable tips or improvement ideas they could add to their workflow. Be specific and practical. Format each tip as a numbered list (1. 2. 3.). Keep tips concise (1-2 lines each). Reply in the same language the user used (Spanish, English, Japanese, etc.). If the query mentions a specific use case (like restaurant menu, inventory, etc.), give domain-specific tips. Do NOT use emojis.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"User query: {{ $('Extract Keywords & Detect Intent').first().json.userRequest }}\\n\\nSearch keywords: {{ $('Extract Keywords & Detect Intent').first().json.searchQuery }}\\n\\nTemplates found: {{ $json.workflows ? $json.workflows.map(w => w.name).join(', ') : 'none' }}\"\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "9cad6de8-9fe4-46cd-aba0-01b3c5cb55ca",
      "name": "AI Suggest Alternatives",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4176,
        864
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "POST",
        "options": {
          "timeout": 60000
        },
        "jsonBody": "={\n  \"model\": \"gpt-4o-mini\",\n  \"max_tokens\": 400,\n  \"temperature\": 0.7,\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are an n8n automation expert. The user searched for templates but found no results. Suggest 3 alternative search terms they could try, and give 2-3 tips on how they could build this workflow from scratch using n8n nodes. Be encouraging and practical. Reply in the same language the user used. Do NOT use emojis.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"User query: {{ $('Extract Keywords & Detect Intent').first().json.userRequest }}\\nSearch keywords used: {{ $('Extract Keywords & Detect Intent').first().json.searchQuery }}\"\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "595a3450-f9ce-416a-b6a0-d4e6540097e9",
      "name": "Format Results + Tips",
      "type": "n8n-nodes-base.code",
      "position": [
        4384,
        672
      ],
      "parameters": {
        "jsCode": "const slackData = $('Extract Keywords & Detect Intent').first().json;\nconst searchResultNode = $('Has Results?').first().json;\nconst workflows = searchResultNode.workflows || [];\nconst searchQuery = slackData.searchQuery || '';\n\nconst results = workflows.slice(0, 5).map((w, i) =>\n  `${i + 1}. <https://n8n.io/workflows/${w.id}|${w.name}>`\n).join('\\n');\n\nlet tips = '';\ntry {\n  const aiResponse = $input.first().json;\n  if (aiResponse.choices && aiResponse.choices[0]) {\n    tips = aiResponse.choices[0].message.content;\n  }\n} catch (e) {\n  tips = '';\n}\n\nlet text = `*Search:* \\`${searchQuery}\\`\\n\\n`;\ntext += `*Templates found:*\\n${results}\\n\\n`;\n\nif (tips) {\n  text += `---\\n`;\n  text += `*Tips & ideas para tu workflow:*\\n${tips}\\n`;\n}\n\ntext += `\\n_Powered by n8n Template Bot_`;\n\nreturn [{\n  json: {\n    ...slackData,\n    text,\n    resultCount: workflows.length,\n    fromCache: false\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "11e60ed3-5aca-4b33-ae0d-50c61318b0a0",
      "name": "Format No Results + Suggestions",
      "type": "n8n-nodes-base.code",
      "position": [
        4384,
        864
      ],
      "parameters": {
        "jsCode": "const slackData = $('Extract Keywords & Detect Intent').first().json;\nconst searchQuery = slackData.searchQuery || '';\n\nlet suggestions = '';\ntry {\n  const aiResponse = $input.first().json;\n  if (aiResponse.choices && aiResponse.choices[0]) {\n    suggestions = aiResponse.choices[0].message.content;\n  }\n} catch (e) {\n  suggestions = '';\n}\n\nlet text = `*Search:* \\`${searchQuery}\\`\\n\\n`;\ntext += `No encontre templates exactos para tu busqueda.\\n\\n`;\n\nif (suggestions) {\n  text += `*Pero aqui van algunas sugerencias:*\\n${suggestions}\\n\\n`;\n}\n\ntext += `_Intenta con otros keywords o escribe \\`@bot categories\\` para ver categorias._\\n`;\ntext += `_Powered by n8n Template Bot_`;\n\nreturn [{\n  json: {\n    ...slackData,\n    text,\n    resultCount: 0,\n    fromCache: false\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "9a82d5d2-8249-4410-a8d1-50045659e358",
      "name": "Reply in Slack Thread",
      "type": "n8n-nodes-base.slack",
      "position": [
        4656,
        752
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.channel }}"
        },
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2918f595-8684-4dd0-b80a-fb046037eb7a",
      "name": "Log to Analytics Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4896,
        688
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Analytics"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a spreadsheet..."
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "da32f4a8-3d9e-4606-a1a7-868dde8e4e53",
      "name": "Save to Cache Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4896,
        848
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Cache"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a spreadsheet..."
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "25eeb69f-5954-4fc3-bef0-ce8e73513421",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        3584,
        1184
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a3f5b0ea-c026-46eb-8686-ab4a7c92837f",
      "name": "Error Reply in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        3856,
        1184
      ],
      "parameters": {
        "text": "Something went wrong while processing your request. Please try again in a moment.\n\nIf the issue persists, try simpler search terms or type `@bot help` for usage tips.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "344ee196-083a-4dda-bd29-c79d8ce9c190",
      "name": "Weekly Analytics Cron",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        4128,
        1184
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "51d09a31-82a2-4b97-8459-2178fe659c82",
      "name": "Read Analytics Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4352,
        1184
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Analytics"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a spreadsheet..."
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "26b22a54-20a3-4cb0-b7c9-cfb5692b8f0a",
      "name": "Generate Weekly Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        4576,
        1184
      ],
      "parameters": {
        "jsCode": "const rows = $input.all().map(i => i.json);\nconst oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);\n\nconst recent = rows.filter(r => new Date(r.Timestamp) >= oneWeekAgo);\n\nif (recent.length === 0) {\n  return [{ json: { text: '*Weekly Bot Report:* No searches this week.' } }];\n}\n\nconst queryCounts = {};\nconst intentCounts = { search: 0, help: 0, categories: 0 };\nlet totalResults = 0;\nlet cacheHits = 0;\n\nfor (const row of recent) {\n  const q = (row.Keywords || row.Query || '').toLowerCase();\n  queryCounts[q] = (queryCounts[q] || 0) + 1;\n  intentCounts[row.Intent || 'search']++;\n  totalResults += parseInt(row.ResultCount || '0');\n  if (row.FromCache === 'true' || row.FromCache === true) cacheHits++;\n}\n\nconst topSearches = Object.entries(queryCounts)\n  .sort((a, b) => b[1] - a[1])\n  .slice(0, 10)\n  .map(([q, count], i) => `${i + 1}. \\`${q}\\` (${count}x)`)\n  .join('\\n');\n\nconst avgResults = recent.length > 0 ? (totalResults / recent.length).toFixed(1) : 0;\n\nconst text = '*Weekly n8n Template Bot Report*\\n' +\n  '---\\n\\n' +\n  `*Total searches:* ${recent.length}\\n` +\n  `*Search:* ${intentCounts.search} | *Help:* ${intentCounts.help} | *Categories:* ${intentCounts.categories}\\n` +\n  `*Avg results per search:* ${avgResults}\\n` +\n  `*Cache hits:* ${cacheHits} (${((cacheHits/recent.length)*100).toFixed(0)}%)\\n\\n` +\n  `*Top searches this week:*\\n${topSearches}\\n\\n` +\n  '_Auto-generated weekly report_';\n\nreturn [{ json: { text } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "8e775a45-f38c-45ff-b5df-bfb60da40d52",
      "name": "Post Weekly Summary to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        4784,
        1184
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": "Select a channel..."
        },
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "Cache Hit?": {
      "main": [
        [
          {
            "node": "Use Cached Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search n8n Templates API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Results?": {
      "main": [
        [
          {
            "node": "AI Generate Tips & Suggestions",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Suggest Alternatives",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Error Reply in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Intent": {
      "main": [
        [
          {
            "node": "Check Cache - Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Help Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Categories Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use Cached Result": {
      "main": [
        [
          {
            "node": "Reply in Slack Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Analytics Data": {
      "main": [
        [
          {
            "node": "Generate Weekly Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Results + Tips": {
      "main": [
        [
          {
            "node": "Reply in Slack Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply in Slack Thread": {
      "main": [
        [
          {
            "node": "Log to Analytics Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save to Cache Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Analytics Cron": {
      "main": [
        [
          {
            "node": "Read Analytics Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Help Response": {
      "main": [
        [
          {
            "node": "Reply in Slack Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Suggest Alternatives": {
      "main": [
        [
          {
            "node": "Format No Results + Suggestions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Weekly Summary": {
      "main": [
        [
          {
            "node": "Post Weekly Summary to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search n8n Templates API": {
      "main": [
        [
          {
            "node": "Has Results?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Cache - Google Sheets": {
      "main": [
        [
          {
            "node": "Cache Hit?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger - Bot Mention": {
      "main": [
        [
          {
            "node": "Extract Keywords & Detect Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Categories Response": {
      "main": [
        [
          {
            "node": "Reply in Slack Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Generate Tips & Suggestions": {
      "main": [
        [
          {
            "node": "Format Results + Tips",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format No Results + Suggestions": {
      "main": [
        [
          {
            "node": "Reply in Slack Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Keywords & Detect Intent": {
      "main": [
        [
          {
            "node": "Route by Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}