{
  "name": "Workflow to summary group Whatsapp",
  "nodes": [
    {
      "id": "8156015a-9436-4fe3-b0ca-b835fd90936d",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        256,
        -112
      ]
    },
    {
      "id": "56eb0e1d-d84e-4108-8357-99dd0e90ed4e",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        400,
        -112
      ]
    },
    {
      "id": "29d17f2d-b3cf-4cae-ab5e-c99a009c906b",
      "name": "Transcrever Áudio",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        944,
        0
      ]
    },
    {
      "id": "d47bb0da-553f-4dd7-8b20-61b0e3b8aa2b",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        768,
        0
      ]
    },
    {
      "id": "94987a7d-92e2-4c73-8281-70aacd4e872e",
      "name": "Audio - HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        608,
        0
      ]
    },
    {
      "id": "103ea5f3-2d64-43cf-a63b-879acf5dff9c",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -80,
        -112
      ]
    },
    {
      "id": "db0c6ad3-f934-4935-88da-8e7cffe7e60d",
      "name": "Salvar mensagens na planilha",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        -112
      ]
    },
    {
      "id": "667a0010-994e-452d-b8b9-a3681e48f1b4",
      "name": "Buscar Grupos",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1648,
        -96
      ]
    },
    {
      "id": "a6ada830-dac1-4f10-aa8b-6d0dcbe9a4a0",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        -112
      ]
    },
    {
      "id": "2e2fa4c6-25f4-40ea-a417-8799b3fb4b3d",
      "name": "Finaliza Fluxo",
      "type": "n8n-nodes-base.noOp",
      "position": [
        320,
        128
      ]
    },
    {
      "id": "f111e292-37f6-49a1-92f8-f1a0dfcdd6bf",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        2000,
        -96
      ]
    },
    {
      "id": "e78d2dc2-82e7-4512-a100-0c88039f2747",
      "name": "Verifica Aba Filtro de Grupos",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1840,
        -96
      ]
    },
    {
      "id": "b803ca71-5675-4064-99c9-6a3af1c08e6a",
      "name": "Finaliza Fluxo2",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2224,
        160
      ]
    },
    {
      "id": "9d1f3027-3059-4c26-833c-11c66e08cebb",
      "name": "Salva grupo para Envio",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2208,
        -96
      ]
    },
    {
      "id": "3330b6e0-7330-49af-9b14-ebc98ceac9d2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -192
      ],
      "parameters": {
        "width": 340,
        "height": 260,
        "content": "## Recebe mensagem\n### Verifica se é de Grupo"
      }
    },
    {
      "id": "ec7bceb5-2adb-4b7a-8a93-23997842bc9d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        96
      ],
      "parameters": {
        "width": null,
        "height": 180,
        "content": "### Se não for, finaliza o fluxo"
      }
    },
    {
      "id": "6a341bca-8fd7-4392-9f7b-765b9d8e835f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -192
      ],
      "parameters": {
        "width": 300,
        "height": 260,
        "content": "### Organiza as mensagens e define o formato (texto, audio)"
      }
    },
    {
      "id": "817b285e-9301-427c-99ae-e6123b0e45b9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -48
      ],
      "parameters": {
        "width": 684,
        "height": 200,
        "content": "### Transcreve o áudio"
      }
    },
    {
      "id": "aa1772a8-4d57-4ce3-8067-8142e3034381",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -160
      ],
      "parameters": {
        "width": 320,
        "height": 220,
        "content": "### Salva Mensagens na Planilha"
      }
    },
    {
      "id": "ba974cdb-c1f0-44e7-ae85-5e3fa05936af",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        -160
      ],
      "parameters": {
        "width": 150,
        "height": 220,
        "content": "### Busca Grupo\n"
      }
    },
    {
      "id": "755cabcb-7be7-4c15-a7bb-2c723ae6e50c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        112
      ],
      "parameters": {
        "width": 200,
        "height": 180,
        "content": "### Se sim, finaliza o fluxo"
      }
    },
    {
      "id": "318ae320-903f-43d9-a96f-795736cfa67b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        -160
      ],
      "parameters": {
        "width": 320,
        "height": 220,
        "content": "### Vê se exista o Grupo na planilha"
      }
    },
    {
      "id": "686ebd9c-b8db-4b3a-bd05-37f8513108f7",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        -176
      ],
      "parameters": {
        "width": 190,
        "height": 240,
        "content": "### Ativa opção de Mandar Resumo\n"
      }
    },
    {
      "id": "e7feadad-c73e-4bec-b64c-6a700818a70e",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1296,
        -112
      ]
    },
    {
      "id": "82708e37-6a00-40ba-a84b-20a560af4c8b",
      "name": "Edit Fields 2",
      "type": "n8n-nodes-base.set",
      "position": [
        1104,
        0
      ]
    },
    {
      "id": "0b5800d4-81cb-4afa-bae1-9aa0821015dc",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -64,
        576
      ]
    },
    {
      "id": "64317e8e-b50a-476c-811b-604daddbebb4",
      "name": "Separar mensagens por grupos",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        576
      ]
    },
    {
      "id": "3f60aea9-578f-416b-ad19-8cee684cd906",
      "name": "Acessar conversas na Planilha",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        176,
        576
      ]
    },
    {
      "id": "f63ccae6-4dc0-4eeb-8743-a43b208bdcaa",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        752,
        576
      ]
    },
    {
      "id": "583bc065-2c88-410c-a587-06f5f9c5e3e6",
      "name": "Replace Me",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1472,
        720
      ]
    },
    {
      "id": "8b8ab6a1-fdff-4a21-9f90-ec5051750197",
      "name": "Enviar mensagem",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        608
      ]
    },
    {
      "id": "64316869-bd04-45d0-b607-97fe50f669a3",
      "name": "Validar Grupo",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        576
      ]
    },
    {
      "id": "109e8f79-fac4-4bde-b7c1-1560e5fd7633",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        496
      ],
      "parameters": {
        "width": 220,
        "height": 260,
        "content": "### Roda todo dia\n#### 08am"
      }
    },
    {
      "id": "891a53c0-78a7-4869-aaf0-990d459d1f32",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        496
      ],
      "parameters": {
        "width": 540,
        "height": 260,
        "content": "### Acessa a data do último dia\n### Valida se o grupo está habilitado para mandar o resumo"
      }
    },
    {
      "id": "5e485cb0-f014-4093-b23f-829b73e593bf",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        496
      ],
      "parameters": {
        "width": 940,
        "height": 440,
        "content": "### IA faz o resumo das mensagens do dia anterior e envia no grupo em questão."
      }
    },
    {
      "id": "f32c28e1-ea18-4f50-9a84-bef3c2eb123f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        944,
        784
      ]
    },
    {
      "id": "5d995287-02b1-4280-9afd-1f6b2abddf9f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        976,
        608
      ]
    },
    {
      "id": "75b98ac9-14fd-4143-93ad-1a893d237585",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -192
      ],
      "parameters": {
        "width": 320,
        "height": 256,
        "content": "## Part 1 - Message Capture and Storage\n\n## Parte 1 – Captura e Armazenamento das Mensagens"
      }
    },
    {
      "id": "7e5de8cf-34de-41a3-abc9-6ba5c8a2f7b2",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        496
      ],
      "parameters": {
        "width": 320,
        "height": 256,
        "content": "## Part 2 -Summary Generation and Delivery\n\n## Parte 2 – Geração e Envio do Resumo\n\n"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finaliza Fluxo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Salva grupo para Envio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finaliza Fluxo2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Salvar mensagens na planilha",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Audio - HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Enviar mensagem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Replace Me": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar Grupos": {
      "main": [
        [
          {
            "node": "Verifica Aba Filtro de Grupos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields 2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Validar Grupo": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Transcrever Áudio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enviar mensagem": {
      "main": [
        [
          {
            "node": "Replace Me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Acessar conversas na Planilha",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transcrever Áudio": {
      "main": [
        [
          {
            "node": "Edit Fields 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio - HTTP Request": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Salvar mensagens na planilha": {
      "main": [
        [
          {
            "node": "Buscar Grupos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Separar mensagens por grupos": {
      "main": [
        [
          {
            "node": "Validar Grupo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Acessar conversas na Planilha": {
      "main": [
        [
          {
            "node": "Separar mensagens por grupos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verifica Aba Filtro de Grupos": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}