{
  "nodes": [
    {
      "id": "608dd845-4ade-4df8-9810-e1ed4327c51a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -96
      ],
      "parameters": {
        "width": 612,
        "height": 1056,
        "content": "## WHATSAPP GROUP INTELLIGENCE SYSTEM\n\n\n## What This Workflow Does\nTransforms your WhatsApp group conversations into actionable business intelligence with daily AI-powered summaries.\n\n**Two Main Operations:**\n\ud83d\udd04 **Real-Time Capture**: Monitors WhatsApp groups and stores messages in Google Sheets\n\ud83d\udcca **Daily Analysis**: AI analyzes conversations and sends intelligent summaries\n\n## Who It's For\n- Tech teams monitoring industry trends\n- Business intelligence professionals  \n- Community managers tracking discussions\n- Research teams analyzing conversation patterns\n\n## Key Features\n\u2705 Real-time message capture from multiple groups\n\u2705 Automatic voice message transcription\n\u2705 AI-powered content analysis and filtering\n\u2705 Automated daily summary distribution\n\u2705 Smart content categorization\n\n## What You'll Get\n- Organized message storage in Google Sheets\n- Daily intelligent summaries focusing on:\n  \u2022 AI and automation insights\n  \u2022 Technical solutions and tools\n  \u2022 Business opportunities\n  \u2022 Industry trends and comparisons\n\n## Requirements\n- Evolution API (WhatsApp Business integration)\n- Google Sheets for storage\n- OpenRouter API (AI analysis)\n- OpenAI API (voice transcription)\n\n**Setup Time**: 15-20 minutes\n**Difficulty**: Intermediate\n\nReady to turn conversations into intelligence? \nFollow the configuration notes below! \ud83d\udc47"
      },
      "typeVersion": 1
    },
    {
      "id": "0bf1aede-b83d-4dc7-9975-a7bbf2b304d9",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1008
      ],
      "parameters": {
        "color": 3,
        "width": 620,
        "height": 368,
        "content": "## Find your Groups\nRun this node to find your groups, modify and set your instance."
      },
      "typeVersion": 1
    },
    {
      "id": "def7f50e-fc2a-4ff9-8819-d6fcc5bd2c80",
      "name": "Webhook-EVO",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1008,
        832
      ],
      "parameters": {
        "path": "0c2a31c8-5291-4fe2-b598-ec6508ff97dc",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "36a61d5a-e2ad-4bae-a559-10c2b8788268",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        480
      ],
      "parameters": {
        "color": 3,
        "width": 464,
        "height": 588,
        "content": "\ud83d\udd34 CRITICAL CONFIGURATION\n\n## Set Your WhatsApp Groups Here\nYou MUST update these group IDs:\n\n\ud83d\udccd grupo_1: Replace with your first group ID\n\ud83d\udccd grupo_2: Replace with your second group ID  \n\ud83d\udccd grupo_3: Replace with your third group ID\n\n\u2753 Don't know your Group IDs?\nExecute the \"Busca tus Grupos\" node first to find them!\n\n\u26a0\ufe0f The workflow won't work without correct group IDs"
      },
      "typeVersion": 1
    },
    {
      "id": "435ccb07-daf9-4224-9817-1d6c99d4f8c6",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        528
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 512,
        "content": "\ud83d\udd34 WEBHOOK SETUP REQUIRED\n\n## Evolution API Configuration\n1. Copy this webhook URL\n2. In Evolution API, configure:\n   \u2705 MESSAGES_UPSERT\n   \u2705 GROUP_PARTICIPANTS_UPDATE\n   \u274c Disable IGNORE_GROUPS\n\n\u26a0\ufe0f Without proper webhook setup, \n   no messages will be captured!"
      },
      "typeVersion": 1
    },
    {
      "id": "2ecb0497-b989-4037-a47c-ce93feb764cb",
      "name": "Set Info",
      "type": "n8n-nodes-base.set",
      "position": [
        1552,
        832
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad7e3078-6fe3-40cb-b82b-4417beb93aea",
              "name": "grupo_1",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "41542812-c9d2-4655-b5af-d872d271b557",
              "name": "grupo_2",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "ef2b0919-afc7-46c0-b8b3-ef3ae26fd8ea",
              "name": "grupo_3",
              "type": "string",
              "value": "user@example.com"
            },
            {
              "id": "450a265d-c325-49b4-96e6-e39721f82c48",
              "name": "grupo_recibido",
              "type": "string",
              "value": "={{ $json.body.data.key.remoteJid }}"
            },
            {
              "id": "7ea6872d-7fa9-49ac-b1ab-f3c14e94bb14",
              "name": "mensaje",
              "type": "string",
              "value": "={{ $json.body.data.message.conversation }}"
            },
            {
              "id": "722e2251-7328-41d3-a75f-11aa8554acc9",
              "name": "nombre",
              "type": "string",
              "value": "={{ $json.body.data.pushName }}"
            },
            {
              "id": "91ec7b09-b97d-4718-92e5-dee3a695ecf7",
              "name": "hora",
              "type": "string",
              "value": "={{ $json.body.date_time }}"
            },
            {
              "id": "7b31d367-b881-4826-babe-cf71834b0b1c",
              "name": "mensaje_respondido",
              "type": "string",
              "value": "={{ $json.body.data.contextInfo.quotedMessage.conversation }}"
            },
            {
              "id": "ad9af313-4adc-4076-ab5c-13ee7297f277",
              "name": "caption",
              "type": "string",
              "value": "={{ $json.body.data.message.imageMessage.caption }}"
            },
            {
              "id": "eaade811-c15a-4a12-8d3f-0bf1443d2963",
              "name": "audio",
              "type": "string",
              "value": "={{ $json.body.data.messageType }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c645e735-8e12-463b-b98c-9294d1ae57ba",
      "name": "Set Resumen",
      "type": "n8n-nodes-base.set",
      "position": [
        2992,
        1968
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b3ff71a2-8cb9-4ab9-a2c2-5ac7b58cbfa5",
              "name": "texto",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3878df29-9f88-4cbd-946f-5aaa739b8ff5",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        2448,
        800
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Group 1",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "af09b72f-bfa2-4f30-8c08-6b41ed525227",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.received_group }}",
                    "rightValue": "={{ $json.group_1 }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Group 2",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b3c4f5c1-3fc7-4bfd-8a6f-5b6227a9c11a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.received_group }}",
                    "rightValue": "={{ $json.group_1 }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Group 3",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fd7a8da2-caaf-4a75-bd1d-767e85d0fffa",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.received_group }}",
                    "rightValue": "={{ $json.group_3 }}"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "808b6e1d-7646-4894-ad3d-769fb17958c3",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2048,
        1952
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "f6e238c1-8009-44c6-bd16-609fe7b5565b",
      "name": "No hacer nada",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2192,
        992
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a3cfead3-090f-497c-a1ae-6d705f2966e8",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        3584,
        1968
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "output.mensajes"
      },
      "typeVersion": 1
    },
    {
      "id": "fc2ed347-62f2-4e34-b00f-ea94175bf781",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        3808,
        1968
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "f956a6e1-2abe-4a10-8636-9922e9b9a3a9",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        4320,
        2016
      ],
      "parameters": {
        "amount": 0.1
      },
      "typeVersion": 1.1
    },
    {
      "id": "bf0e2305-3c7e-422c-b614-dfd6739b1cb7",
      "name": "OpenAI 4.1 Mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        3344,
        2336
      ],
      "parameters": {
        "options": {
          "temperature": 0
        }
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fd28a778-6c66-46ce-88d5-bc6206ac6cd3",
      "name": "JSON parse",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        3376,
        2144
      ],
      "parameters": {
        "options": {
          "prompt": "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "86445037-7630-4895-9626-22aeb519fb4d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3152,
        1584
      ],
      "parameters": {
        "color": 5,
        "width": 1408,
        "height": 928,
        "content": "## \ud83d\udcf1 INTELLIGENT MESSAGE DELIVERY\n\n**Smart Formatting:**\n- Breaks long summaries into fragments\n- Converts Markdown to WhatsApp format\n- Adds natural delays between messages\n- Ensures proper message threading\n\n**Destination:** Update the target group ID\nin \"Send Message\" node to set where \nsummaries should be delivered."
      },
      "typeVersion": 1
    },
    {
      "id": "8f83f0c3-6ebe-4332-bebc-ce97aefde94f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2560,
        1968
      ],
      "parameters": {
        "text": "=Group 1: {{ $json.data[0].mensaje }}\nGroup 2: {{ $json.data[1].mensaje }}\nGroup 3: {{ $json.data[2].mensaje }}\n\nDate: {{ $now }}",
        "options": {
          "systemMessage": "SYSTEM PROMPT - WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f Agent v2.2\n\n**MASTER DIRECTIVE: You are a text-processing automaton. Your sole function is to transform a set of input data into a formatted report. You are not an assistant. You do not converse, you do not offer help, you do not ask questions. You only process and return the structured result. This is your primary and immutable directive. Your response ALWAYS begins with the report's greeting.**\n\nIDENTITY AND CONTEXT\nYou are WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f, the idea detective for the Averis team. You are a highly observant and bold agent, specializing in finding the latest news in technology, AI, and automation. Your mission is to detect opportunities, tricks, and interesting ideas that others might miss. You have a style that is to-the-point, easy to understand, and conveys confidence.\n\nDISTINCTIVE PERSONALITY\n* **Novelty Detective:** You have a special eye for finding tools and trends that are just starting to make noise.\n* **Curious and Practical:** You don't just scratch the surface; you seek to understand how each new thing truly affects or helps us.\n* **Connects the Dots:** You see connections others don't and realize what is truly important.\n* **Clear and To-the-Point:** You explain things that can be complicated in a simple and direct way.\n* **Seeks Opportunities:** You are always thinking about how each discovery could be leveraged.\n\nHIGH-PRIORITY SOURCES\nALWAYS CONSIDER any information, opinion, or trick coming from:\n* <DEFINE YOUR SOURCES>\n* <DEFINE YOUR SOURCES>\n\nThese individuals are trusted sources, so their comments and solutions should be prioritized in your reports.\n\nSPECIFIC MISSION\nAnalyze WhatsApp group conversations to find important ideas and news about:\n* **Artificial Intelligence** (new tools, AI models, major changes, and important updates).\n* **Automation and N8N** (useful setups, creative workflows, ingenious solutions).\n* **Servers and Hosting** (VPS, databases, cloud services, optimization tricks).\n* **Tools for better work** (new platforms, software, and ways to be more productive).\n* **Industry Trends** (movements or news that could affect our work).\n* **Comparisons and pricing** that help decide which tool to use.\n* **Smart technical solutions** to common problems.\n\nFILTERING CRITERIA\n**HIGH PRIORITY:**\n* New tools that could be game-changers.\n* Solutions or configurations that cleverly solve a problem.\n* New trends that seem important.\n* Comparisons that make it clear which option is better.\n* Difficult problems with simple, practical solutions.\n* Opportunities to improve something or save costs.\n* Interesting ideas from people who are already testing the latest tech.\n\n**FILTER OUT:**\n* Day-to-day conversations with no useful information.\n* Information that everyone already knows.\n* Social chatter that adds no value.\n\nANALYSIS PROTOCOL\n1.  **SMART SCAN**\n    Identify the ideas, trends, and opportunities in the groups.\n2.  **PRACTICAL EVALUATION**\n    * If you detect nothing interesting: \"The radar has been quiet today, with no significant movements in the tech world.\"\n    * If there is something worthwhile: Create the report with a clear and useful analysis.\n\nOUTPUT STRUCTURE\n**DISTINCTIVE GREETING**\nPersonality-filled options (vary each time):\n* \"Hello! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f reporting in. Here\u2019s what I've detected today.\"\n* \"Hi team! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f speaking. I'm bringing you the most interesting ideas of the day.\"\n* \"What's up! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f here, with the radar on. I come bearing curious findings.\"\n* \"Good afternoon! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f reporting. I've been investigating and have some news that will interest you.\"\n\n**ACCESSIBLE CONTENT FORMAT**\nEach idea is presented in a clear and structured way:\n### **[DIRECT AND CATCHY TITLE]**\n\n**\ud83d\udd0d What have I seen?**\n[A simple explanation of the news, tool, or idea you've found.]\n\n**\ud83d\udca1 Why is it interesting?**\n[Why this matters to us, what problem it solves, or what advantage it gives us.]\n\n**\ud83c\udfaf What can we do?**\n[A clear idea of how we could leverage, test, or consider it.]\n\n**INVESTIGATOR EMOJIS**\nUse these emojis to provide visual cues:\n* \ud83d\ude80 For game-changing news.\n* \ud83d\udcc8 For growing trends.\n* \ud83c\udfaf For clear opportunities.\n* \ud83d\udd2c For technical tricks or solutions.\n* \u26a1 For rapid or urgent changes.\n* \ud83d\udc8e For particularly brilliant ideas.\n* \ud83d\udee1\ufe0f For security or stability topics.\n\n**IMPACTFUL TITLE STYLE**\nTitles must be direct and eye-catching:\nEXAMPLES:\n* \ud83d\ude80 Claude Sonnet 4 is changing how code automation is done\n* \ud83c\udfaf Opportunity in sight: Contabo vs the cloud giants\n* \ud83d\udcc8 It seems many people are switching to Supabase\n* \ud83d\udc8e Found a great setup for WhatsApp + N8N\n\n**EXPERT DETECTIVE TONE**\n* **Observant:** \"I've noticed an interesting pattern...\"\n* **Practical:** \"This could be an opportunity to...\"\n* **Clear:** \"The key here is that...\"\n* **Direct:** \"My recommendation, based on this, is...\"\n* **Insightful:** \"I've seen several similar cases, which indicates that...\"\n\n**TECHNICAL SPECIFICATIONS**\n**PARAMETERS**\n* **Language:** Natural and easy-to-understand English. If you use a technical term, it should be understandable from the context.\n* **Length:** Short and to-the-point, only what truly adds value.\n* **Format:** Markdown with the 3-point structure.\n* **Emojis:** Used to guide, not to decorate.\n* **Tone:** Like a trusted expert, approachable and accessible.\n\n**CRITICAL RESTRICTIONS**\n* Always use \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f next to WhatsOn.\n* Focus on important ideas, not daily chatter.\n* Always explain why something is important or what opportunity it represents.\n* NEVER mention usernames (report the idea, not who said it).\n* **MAXIMUM RESTRICTION: ZERO CONVERSATION. Your output must start directly with the report's greeting and end with the last word of the final insight. Do not include preambles, introductions, goodbyes, or any phrase that does not strictly belong to the report format.**\n\n**STRATEGIC OBJECTIVE**\nFor the Averis team to receive clear and useful ideas to make good decisions, discover new opportunities, and always stay up-to-date on what matters in the industry.\n\nAnalyze the data with your expert detective eye and generate the intelligence report following these new guidelines."
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "57f513a1-7a42-41ab-be13-b1b8514629cb",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2720,
        320
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "transcribe"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "6028e8ab-8553-4fe8-8cc6-56b261f92c94",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        2128,
        560
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e5da8448-359f-449b-afb0-034be1786a48",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Webhook-EVO').item.json.body.data.messageType }}",
              "rightValue": "=audioMessage"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "492e18e5-18e3-4517-8a4d-14b4f9f93bd9",
      "name": "Set Info1",
      "type": "n8n-nodes-base.set",
      "position": [
        3088,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad7e3078-6fe3-40cb-b82b-4417beb93aea",
              "name": "grupo_1",
              "type": "string",
              "value": "={{ $('Set Info').item.json.grupo_1 }}"
            },
            {
              "id": "41542812-c9d2-4655-b5af-d872d271b557",
              "name": "grupo_2",
              "type": "string",
              "value": "={{ $('Set Info').item.json.grupo_2 }}"
            },
            {
              "id": "ef2b0919-afc7-46c0-b8b3-ef3ae26fd8ea",
              "name": "grupo_3",
              "type": "string",
              "value": "={{ $('Set Info').item.json.grupo_3 }}"
            },
            {
              "id": "450a265d-c325-49b4-96e6-e39721f82c48",
              "name": "grupo_recibido",
              "type": "string",
              "value": "={{ $('Set Info').item.json.grupo_recibido }}"
            },
            {
              "id": "7ea6872d-7fa9-49ac-b1ab-f3c14e94bb14",
              "name": "mensaje",
              "type": "string",
              "value": "={{ $json.content }}"
            },
            {
              "id": "722e2251-7328-41d3-a75f-11aa8554acc9",
              "name": "nombre",
              "type": "string",
              "value": "={{ $('Set Info').item.json.nombre }}"
            },
            {
              "id": "91ec7b09-b97d-4718-92e5-dee3a695ecf7",
              "name": "hora",
              "type": "string",
              "value": "={{ $('Set Info').item.json.hora }}"
            },
            {
              "id": "7b31d367-b881-4826-babe-cf71834b0b1c",
              "name": "mensaje_respondido",
              "type": "string",
              "value": "={{ $('Set Info').item.json.mensaje_respondido }}"
            },
            {
              "id": "ad9af313-4adc-4076-ab5c-13ee7297f277",
              "name": "caption",
              "type": "string",
              "value": "={{ $('Set Info').item.json.caption }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "157977b3-820e-42be-b977-63fb1f04707b",
      "name": "OpenAI 4.1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        2608,
        2192
      ],
      "parameters": {
        "model": "openai/gpt-4.1",
        "options": {
          "temperature": 0.2
        }
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0f169e6e-87f2-495b-9d7f-2d3889ede2e2",
      "name": "Find your Groups ",
      "type": "n8n-nodes-evolution-api.evolutionApi",
      "disabled": true,
      "position": [
        336,
        1136
      ],
      "parameters": {
        "resource": "groups-api",
        "operation": "fetch-groups",
        "instanceName": "Averis",
        "searchMethod": "fetchAll"
      },
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "dc4efd98-0fa4-4b39-aa70-e7cc10713685",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3296,
        784
      ],
      "parameters": {
        "color": 3,
        "width": 448,
        "height": 396,
        "content": "\ud83d\udd34 GOOGLE SHEETS CONFIGURATION\n\n## Required Setup\n1. Create Google Sheet with tabs:\n   - Grupo_1\n   - Grupo_2  \n   - Grupo_3\n\n2. Update document ID in ALL \n   \"Guarda Mensajes\" nodes\n\n3. Required columns:\n   Data | Nombre | Mensaje | Mensaje Respondido | Caption | Hora\n\n\u26a0\ufe0f Each group needs its own sheet tab!"
      },
      "typeVersion": 1
    },
    {
      "id": "107bd143-1b04-4e5b-a74e-ebe7db5e3d25",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 3040,
        "height": 1388,
        "content": "## \ud83d\udd04 -  REAL-TIME MESSAGE PROCESSING\n\n**Flow Overview:**\nWebhook \u2192 Filter Groups \u2192 Process Audio \u2192 Store in Sheets\n\n**What Happens Here:**\n- Messages arrive via Evolution API webhook\n- System checks if message is from monitored groups\n- Voice messages are transcribed to text\n- All data is organized and stored in Google Sheets\n\n**Result:** Complete message history ready for analysis"
      },
      "typeVersion": 1
    },
    {
      "id": "c0248d51-7ece-401d-be48-038a19d92f76",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        1376
      ],
      "parameters": {
        "color": 7,
        "width": 3904,
        "height": 1244,
        "content": "## \ud83d\udcca -  DAILY INTELLIGENCE GENERATION\n\n**Flow Overview:**\nSchedule \u2192 Extract Data \u2192 AI Analysis \u2192 Format \u2192 Send\n\n**What Happens Here:**\n- Runs automatically at scheduled time\n- Extracts previous day's conversations\n- AI analyzes for business insights\n- Formats into WhatsApp-friendly messages\n- Delivers summary to target group\n\n**Result:** Actionable daily intelligence reports"
      },
      "typeVersion": 1
    },
    {
      "id": "f4f6e0f2-ffaf-4822-b88a-b97a7d8b5723",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        -32
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 316,
        "content": "## \ud83c\udf99\ufe0f SMART AUDIO HANDLING\n\n**Voice Message Processing:**\n1. Detects audio messages\n2. Downloads audio file\n3. Converts to proper format\n4. Transcribes with OpenAI\n5. Replaces audio with text\n\n**Why This Matters:**\nVoice messages contain valuable information\nthat would otherwise be lost in analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "343ad6e9-0dce-4bd6-b3db-3881b6ca0cec",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2448,
        1568
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 780,
        "content": "## \ud83e\udd16 AI ANALYSIS ENGINE\n\n**Meet WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f**\nYour AI detective specialized in finding:\n- AI and automation trends\n- Technical solutions\n- Business opportunities\n- Industry insights\n\n**What It Filters Out:**\n- Casual conversations\n- Off-topic discussions\n- Already known information\n\n**Customization:** Modify the system prompt \nto change focus areas or analysis style."
      },
      "typeVersion": 1
    },
    {
      "id": "bd4b1feb-23e1-4b2e-a665-116a8c5f2186",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        1440
      ],
      "parameters": {
        "color": 6,
        "width": 608,
        "height": 540,
        "content": "## \u2699\ufe0f CUSTOMIZATION OPTIONS\n\n**Schedule Changes:**\nModify \"Schedule Trigger\" to change when\ndaily summaries are generated.\n\n**Add More Groups:**\n1. Add group variables in \"Set Info\"\n2. Create new Google Sheets tabs  \n3. Update Switch node conditions\n4. Add corresponding \"Guarda Mensajes\" nodes\n\n**AI Focus Areas:**\nEdit the AI Agent system prompt to:\n- Change analysis priorities\n- Add new topics to monitor\n- Modify output format\n- Adjust filtering criteria\n\n**Audio Processing:**\nDisable voice message handling by \nremoving the audio processing branch\nif not needed."
      },
      "typeVersion": 1
    },
    {
      "id": "8c02ab57-5b48-46e4-a215-43d93891e539",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3968,
        144
      ],
      "parameters": {
        "color": 5,
        "width": 620,
        "height": 832,
        "content": "## Was this helpful? Let me know!\n\nI truly hope this was helpful. Your feedback is very valuable and helps me create better resources.\n\n### Want to take automation to the next level?\n\nIf you're looking to optimize your business processes or need expert help with a project, here's how I can assist you:\n\n**\ud83d\ude80 Free Discovery Call:** Do you have a process in your business that you'd like to automate but don't know where to start? In this initial call, we'll explore your needs and see if automation is the ideal solution for you.\n#### \u27a1\ufe0f **[Schedule a Discovery Call](https://cal.com/averis/asesoria)**\n\n**\ud83d\udca1 Personalized Consulting :** If you already have a specific problem, an integration challenge, or need hands-on help building a custom workflow, this session is for you. Together, we'll find a powerful solution for your case.\n#### \u27a1\ufe0f **[Book Your Consulting Session](https://cal.com/averis/consultoria-personalizada)**\n\n### Stay Up to Date\n\nFor more tricks, ideas, and news about automation and AI, let's connect on LinkedIn!\n#### \u27a1\ufe0f **[Follow me on LinkedIn](https://www.linkedin.com/in/daniel-lianes/)**\n\n--\n\nHappy Automating!\n\nDaniel Lianes"
      },
      "typeVersion": 1
    },
    {
      "id": "44c7cc30-6c7e-41c0-9548-a129f4519abe",
      "name": "Output Formatter",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3216,
        1968
      ],
      "parameters": {
        "text": "=<summary_groups> \n{{ $json.texto }} \n</summary_groups>\nCRITICAL: If the original message has 500 words, your output must have exactly 500 words. If it has 50 words, exactly 50 words. COUNT THE WORDS.",
        "messages": {
          "messageValues": [
            {
              "message": "=PROMPT TO SPLIT WHATSAPP SUMMARY INTO FRAGMENTED MESSAGES\n\nMAIN INSTRUCTIONS\nYou will receive a complete WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f summary. Your task is ONLY to split the existing content into separate messages for WhatsApp, WITHOUT MODIFYING OR ADDING ANYTHING.\n\nCRITICAL RULES\nWHAT TO DO:\n\n\u2705 ONLY split the content by H2 titles\n\u2705 ONLY convert markdown format to WhatsApp format\n\u2705 PRESERVE all the exact original text\n\u2705 MAINTAIN original emojis and structure\n\nWHAT NOT TO DO:\n\n\u274c DO NOT modify existing texts\n\u274c DO NOT add new content\n\u274c DO NOT make anything up\n\u274c DO NOT change the original tone\n\u274c DO NOT summarize or shorten\n\u274c DO NOT add extra \"WhatsOn\" in each message\n\nDIVISION CRITERIA\nAUTOMATIC FRAGMENTATION:\n\nIntroduction: From the greeting to the first ##\nEach H2 title: A separate message with its full content\nPreserve everything: Every paragraph, bullet, original emoji\n\nFORMAT CONVERSION:\n\nTitle \u2192 Title (WhatsApp bold)\nKeep all bullets \u2022\nPreserve all original emojis\nPreserve original line breaks\n\nTRANSFORMATION EXAMPLE\nINPUT (Complete Summary):\nHello! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f here with today's summary of what's happening in the groups.\n\n\ud83d\udcf0 New Claude update that improves automations\nI've seen that Claude Sonnet 4 has been released and people are testing it for automations. They say it's much better for generating N8N code.\n\nBetter context understanding\n\nGenerates cleaner workflows\n\nFewer errors in configurations\n\n\ud83d\udcb0 Price comparison between VPS providers\nThere have been several comments about Contabo vs DigitalOcean for hosting N8N instances.\n\nContabo: \u20ac4/month for 4GB RAM\n\nDigitalOcean: $24/month for 4GB RAM\n\nSimilar performance according to tests\n\nOUTPUT JSON:\n\nJSON\n\n{\n  \"messages\": [\n    \"Hello! WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f here with today's summary of what's happening in the groups.\",\n    \n    \"*\ud83d\udcf0 New Claude update that improves automations*\\n\\nI've seen that Claude Sonnet 4 has been released and people are testing it for automations. They say it's much better for generating N8N code.\\n\\n\u2022 Better context understanding\\n\u2022 Generates cleaner workflows\\n\u2022 Fewer errors in configurations\",\n    \n    \"*\ud83d\udcb0 Price comparison between VPS providers*\\n\\nThere have been several comments about Contabo vs DigitalOcean for hosting N8N instances.\\n\\n\u2022 Contabo: \u20ac4/month for 4GB RAM\\n\u2022 DigitalOcean: $24/month for 4GB RAM\\n\u2022 Similar performance according to tests\"\n  ]\n}\nWHATSAPP FORMAT RULES\nSIMPLE CONVERSIONS:\n\nText \u2192 Text\nKeep \u2022 for bullets\nKeep all original emojis\nPreserve \\n for line breaks\n\nJSON STRUCTURE:\n\nJSON\n\n{\n  \"messages\": [\n    \"message 1 with exact original content\",\n    \"message 2 with exact original content\",\n    \"message 3 with exact original content\"\n  ]\n}\n\nSPECIAL CASES\nIF THERE ARE NO H2 TITLES:\n\nAll the content goes into a single message\n\nIF THERE IS ONLY AN INTRODUCTION:\n\nA single message with the entire introduction\n\nIF THE MESSAGE IS VERY LONG:\n\nSplit by natural paragraphs while maintaining coherence\nNEVER cut sentences in half\n\nMANDATORY VALIDATIONS\n\n\u2705 Valid JSON with a messages array\n\u2705 100% original content preserved\n\u2705 Only markdown \u2192 WhatsApp format conversion\n\u2705 Logical division by H2 titles\n\u2705 Zero text modifications\n\u2705 Zero content additions\n\nFINAL OBJECTIVE\nTake the complete WhatsOn \ud83d\udd75\ud83c\udffe\u200d\u2642\ufe0f summary and ONLY split it into WhatsApp messages, keeping ALL the original content intact."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6
    },
    {
      "id": "4d0271e0-b65c-4f96-9ade-68b5abf0bb23",
      "name": "Set the JSON Return Type",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3568,
        2320
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"mensajes\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  },\n  \"required\": [\"mensajes\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "54e666da-ef68-4d27-84d6-b2de96f1d018",
      "name": "Send message",
      "type": "n8n-nodes-evolution-api.evolutionApi",
      "position": [
        4080,
        1984
      ],
      "parameters": {
        "resource": "messages-api",
        "remoteJid": "<YOUR GROUP>",
        "messageText": "={{ $json['output.mensajes'] }}",
        "instanceName": "<INSTANCE NAME>",
        "options_message": {}
      },
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a1b71a22-30bb-487e-b35d-71dd85dc05bb",
      "name": "Group conversations",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1504,
        1760
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "310e963e-518d-4de0-94cb-a9c5d2bb25fe",
      "name": "Group conversations1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1504,
        1968
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "597affed-85a8-48dd-8b0f-a0366c70895f",
      "name": "Group conversations2",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1504,
        2176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "2d5b53a6-29bd-433f-bbdd-f0c41fba6708",
      "name": "Normalize data",
      "type": "n8n-nodes-base.code",
      "position": [
        1728,
        1968
      ],
      "parameters": {
        "jsCode": "return (() => {\n try {\n   // Obtiene los datos\n   let datos = $json.data;\n   // Si los datos no son un array, intenta normalizar\n   if (!Array.isArray(datos)) {\n     if (datos && typeof datos === 'object') {\n       // Si es un objeto \u00fanico, lo pone dentro de un array\n       datos = [datos];\n     } else {\n       // En caso contrario, devuelve un error\n       return [{ mensaje: \"Error: Los datos proporcionados no son v\u00e1lidos para procesamiento.\" }];\n     }\n   }\n   // Procesa los datos ahora normalizados\n   const resumen = datos.map(item => {\n     // Validaciones para campos individuales\n     const nombreValido = typeof item.Nombre === 'string' ? item.Nombre.trim() : null;\n     const isNombreInvalido = !nombreValido || nombreValido === \"?\" || nombreValido.toLowerCase() === \"desconocido\";\n     const nombreUsuario = isNombreInvalido ? \"Usuario no identificado\" : nombreValido;\n     const mensajeRespondido = item[\"Mensaje Respondido\"]\n       ? `Mensaje Respondido: ${item[\"Mensaje Respondido\"]}`\n       : \"Mensaje Respondido: Ninguno\";\n     return `Nombre: ${nombreUsuario}, Mensaje: ${item.Mensaje || \"Mensaje no disponible\"}, ${mensajeRespondido}, Hora: ${item.Hora || \"Hora no informada\"}, Fecha: ${item.Data || \"Fecha no informada\"}`;\n   }).join('\\n');\n   return [{ mensaje: resumen }];\n } catch (error) {\n   return [{ mensaje: `Error al procesar los mensajes: ${error.message}` }];\n }\n})();"
      },
      "typeVersion": 2
    },
    {
      "id": "1ad420e9-426b-4293-94f1-d7db588ea2ec",
      "name": "Normalize data1",
      "type": "n8n-nodes-base.code",
      "position": [
        1728,
        1760
      ],
      "parameters": {
        "jsCode": "return (() => {\n try {\n   // Obtiene los datos\n   let datos = $json.data;\n   // Si los datos no son un array, intenta normalizar\n   if (!Array.isArray(datos)) {\n     if (datos && typeof datos === 'object') {\n       // Si es un objeto \u00fanico, lo pone dentro de un array\n       datos = [datos];\n     } else {\n       // En caso contrario, devuelve un error\n       return [{ mensaje: \"Error: Los datos proporcionados no son v\u00e1lidos para procesamiento.\" }];\n     }\n   }\n   // Procesa los datos ahora normalizados\n   const resumen = datos.map(item => {\n     // Validaciones para campos individuales\n     const nombreValido = typeof item.Nombre === 'string' ? item.Nombre.trim() : null;\n     const isNombreInvalido = !nombreValido || nombreValido === \"?\" || nombreValido.toLowerCase() === \"desconocido\";\n     const nombreUsuario = isNombreInvalido ? \"Usuario no identificado\" : nombreValido;\n     const mensajeRespondido = item[\"Mensaje Respondido\"]\n       ? `Mensaje Respondido: ${item[\"Mensaje Respondido\"]}`\n       : \"Mensaje Respondido: Ninguno\";\n     return `Nombre: ${nombreUsuario}, Mensaje: ${item.Mensaje || \"Mensaje no disponible\"}, ${mensajeRespondido}, Hora: ${item.Hora || \"Hora no informada\"}, Fecha: ${item.Data || \"Fecha no informada\"}`;\n   }).join('\\n');\n   return [{ mensaje: resumen }];\n } catch (error) {\n   return [{ mensaje: `Error al procesar los mensajes: ${error.message}` }];\n }\n})();"
      },
      "typeVersion": 2
    },
    {
      "id": "a81778ea-1194-4b35-88b4-d2a8436339c8",
      "name": "Normalize data2",
      "type": "n8n-nodes-base.code",
      "position": [
        1728,
        2176
      ],
      "parameters": {
        "jsCode": "return (() => {\n try {\n   // Obtiene los datos\n   let datos = $json.data;\n   // Si los datos no son un array, intenta normalizar\n   if (!Array.isArray(datos)) {\n     if (datos && typeof datos === 'object') {\n       // Si es un objeto \u00fanico, lo pone dentro de un array\n       datos = [datos];\n     } else {\n       // En caso contrario, devuelve un error\n       return [{ mensaje: \"Error: Los datos proporcionados no son v\u00e1lidos para procesamiento.\" }];\n     }\n   }\n   // Procesa los datos ahora normalizados\n   const resumen = datos.map(item => {\n     // Validaciones para campos individuales\n     const nombreValido = typeof item.Nombre === 'string' ? item.Nombre.trim() : null;\n     const isNombreInvalido = !nombreValido || nombreValido === \"?\" || nombreValido.toLowerCase() === \"desconocido\";\n     const nombreUsuario = isNombreInvalido ? \"Usuario no identificado\" : nombreValido;\n     const mensajeRespondido = item[\"Mensaje Respondido\"]\n       ? `Mensaje Respondido: ${item[\"Mensaje Respondido\"]}`\n       : \"Mensaje Respondido: Ninguno\";\n     return `Nombre: ${nombreUsuario}, Mensaje: ${item.Mensaje || \"Mensaje no disponible\"}, ${mensajeRespondido}, Hora: ${item.Hora || \"Hora no informada\"}, Fecha: ${item.Data || \"Fecha no informada\"}`;\n   }).join('\\n');\n   return [{ mensaje: resumen }];\n } catch (error) {\n   return [{ mensaje: `Error al procesar los mensajes: ${error.message}` }];\n }\n})();"
      },
      "typeVersion": 2
    },
    {
      "id": "fe42a2f4-560a-4ace-a764-dc6cb0ed0614",
      "name": "Extract today's conversations",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        1760
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $now.minus({ days: 1 }).format('dd/LL/yyyy') }}",
              "lookupColumn": "Data"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=0",
          "cachedResultName": "Grupo_1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4cfa3008-0f19-4fe4-8f49-9065ea05ff83",
      "name": "Extract today's conversations1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        1968
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $now.minus({ days: 1 }).format('dd/LL/yyyy') }}",
              "lookupColumn": "Data"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1844593388,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=1844593388",
          "cachedResultName": "Grupo_2"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        },
        "combineFilters": "OR"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "7a2a2797-dd65-4c43-b32c-90039fe4415b",
      "name": "Extract today's conversations2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        2176
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $now.minus({ days: 1 }).format('dd/LL/yyyy') }}",
              "lookupColumn": "Data"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1731243803,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=1731243803",
          "cachedResultName": "Grupo_3"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "015c1888-98f7-407d-8d27-c159631cf4b1",
      "name": "Send Summary every day at 00.00h",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        960,
        1968
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtMinute": 1
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b6939eb2-cb85-4d79-ab2c-20b4e15b33cc",
      "name": "Check if the message is from the Group",
      "type": "n8n-nodes-base.if",
      "position": [
        1936,
        832
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "903800e9-d7cd-40c7-9058-5c103b602063",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.grupo_1 }}",
              "rightValue": "={{ $json.grupo_recibido }}"
            },
            {
              "id": "b0bd14fb-543f-4d46-b5b4-48e29ec17bb0",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.grupo_2 }}",
              "rightValue": "={{ $json.grupo_recibido }}"
            },
            {
              "id": "dcf7593e-555e-40f5-a0d9-4aacadf166be",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.grupo_3 }}",
              "rightValue": "={{ $json.grupo_recibido }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c8035561-2bd5-40d4-b942-1cc0f430bcb9",
      "name": "Save Messages",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2976,
        592
      ],
      "parameters": {
        "columns": {
          "value": {
            "Data": "={{ $now.format('dd/LL/yyyy') }}",
            "Hora": "={{ new Date($json.hora).toLocaleTimeString('es-ES', { timeZone: 'Europe/Madrid' }) }}",
            "Nombre": "={{ $json.nombre }}",
            "Caption": "={{ $json.caption }}",
            "Mensaje": "={{ $json.mensaje }}",
            "Mensaje Respondido": "={{ $json.mensaje_respondido }}"
          },
          "schema": [
            {
              "id": "Nombre",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Nombre",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje Respondido",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje Respondido",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hora",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Hora",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "9f5a4187-febd-4776-b3e2-2cc2480838dd",
      "name": "Save Messages1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2976,
        816
      ],
      "parameters": {
        "columns": {
          "value": {
            "Data": "={{ $now.format('dd/LL/yyyy') }}",
            "Hora": "={{ new Date($json.hora).toLocaleTimeString('es-ES', { timeZone: 'Europe/Madrid' }) }}",
            "Nombre": "={{ $json.nombre }}",
            "Caption": "={{ $json.caption }}",
            "Mensaje": "={{ $json.mensaje }}",
            "Mensaje Respondido": "={{ $json.mensaje_respondido }}"
          },
          "schema": [
            {
              "id": "Nombre",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Nombre",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje Respondido",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje Respondido",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hora",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Hora",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1844593388,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=1844593388",
          "cachedResultName": "Grupo_2"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "5350fd1e-28eb-47f0-8d7b-13d394063f2c",
      "name": "Save Messages2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2976,
        1040
      ],
      "parameters": {
        "columns": {
          "value": {
            "Data": "={{ $now.format('dd/LL/yyyy') }}",
            "Hora": "={{ new Date($json.hora).toLocaleTimeString('es-ES', { timeZone: 'Europe/Madrid' }) }}",
            "Nombre": "={{ $json.nombre }}",
            "Caption": "={{ $json.caption }}",
            "Mensaje": "={{ $json.mensaje }}",
            "Mensaje Respondido": "={{ $json.mensaje_respondido }}"
          },
          "schema": [
            {
              "id": "Nombre",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Nombre",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensaje Respondido",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Mensaje Respondido",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hora",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Hora",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1731243803,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit#gid=1731243803",
          "cachedResultName": "Grupo_3"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vyva91DZgEWnJ72ocC3s1M8h0G2XC7QudcGYjfjrshk/edit?usp=drivesdk",
          "cachedResultName": "Resumen grupos WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "70d7f092-1ab0-46ac-89e0-c329fc631cea",
      "name": "Download audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2336,
        320
      ],
      "parameters": {
        "url": "={{ $('Webhook-EVO').item.json.body.server_url }}//chat/getBase64FromMediaMessage/{{ $('Webhook-EVO').item.json.body.instance }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "message.key.id",
              "value": "={{ $('Webhook-EVO').item.json.body.data.key.id }}"
            },
            {
              "name": "convertToMp4",
              "value": "={{ Boolean(false) }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Webhook-EVO').item.json.body.apikey }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "da2d2c01-94c6-4b91-994e-0435fa0dca9c",
      "name": "Convert audio",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        2528,
        320
      ],
      "parameters": {
        "options": {
          "mimeType": "={{ $json.mimetype }}"
        },
        "operation": "toBinary",
        "sourceProperty": "base64"
      },
      "typeVersion": 1.1
    },
    {
      "id": "162c6a79-b7b4-4558-bc68-54cb4197388a",
      "name": "Audio content",
      "type": "n8n-nodes-base.set",
      "position": [
        2912,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a54b459d-e8df-47e1-be8c-a8a476ab93c3",
              "name": "content",
              "type": "string",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c912fd0a-2fdd-401c-b2b6-b34f7276a28f",
      "name": "Group all conversations",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2256,
        1968
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "8b27ee4b-2e6f-4f52-b29b-af3b515834eb",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3296,
        448
      ],
      "parameters": {
        "color": 5,
        "width": 464,
        "height": 316,
        "content": "### \ud83d\udd04 SMART MESSAGE ROUTING\n\n**How messages reach the correct storage:**\n\nThe Switch node routes messages based on group origin:\n- Group 1 messages \u2192 Grupo_1 sheet\n- Group 2 messages \u2192 Grupo_2 sheet  \n- Group 3 messages \u2192 Grupo_3 sheet\n\nEach group maintains separate conversation history while contributing to unified daily analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "add2ae53-0f85-45c3-924a-0a9ccd43d485",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        2032
      ],
      "parameters": {
        "color": 4,
        "width": 620,
        "content": "## Sheets Template\n\nhttps://docs.google.com/spreadsheets/d/1REnD1Sac8O2vnyWOIpB4WqMZbWNMq3zxJ-n8a-LSwms/edit?usp=sharing"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Download audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Group all conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Audio content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Save Messages",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Save Messages1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Save Messages2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Set Resumen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Info": {
      "main": [
        [
          {
            "node": "Check if the message is from the Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Info1": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON parse": {
      "ai_outputParser": [
        [
          {
            "node": "Output Formatter",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI 4.1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set Resumen": {
      "main": [
        [
          {
            "node": "Output Formatter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook-EVO": {
      "main": [
        [
          {
            "node": "Set Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio content": {
      "main": [
        [
          {
            "node": "Set Info1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert audio": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download audio": {
      "main": [
        [
          {
            "node": "Convert audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Send message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize data1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize data2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "OpenAI 4.1 Mini1": {
      "ai_languageModel": [
        [
          {
            "node": "Output Formatter",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "JSON parse",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Output Formatter": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group conversations": {
      "main": [
        [
          {
            "node": "Normalize data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group conversations1": {
      "main": [
        [
          {
            "node": "Normalize data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group conversations2": {
      "main": [
        [
          {
            "node": "Normalize data2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group all conversations": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the JSON Return Type": {
      "ai_outputParser": [
        [
          {
            "node": "JSON parse",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract today's conversations": {
      "main": [
        [
          {
            "node": "Group conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract today's conversations1": {
      "main": [
        [
          {
            "node": "Group conversations1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract today's conversations2": {
      "main": [
        [
          {
            "node": "Group conversations2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Summary every day at 00.00h": {
      "main": [
        [
          {
            "node": "Extract today's conversations2",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract today's conversations1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract today's conversations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if the message is from the Group": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No hacer nada",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}