AutomationFlowsAI & RAG › My Workflow 7

My Workflow 7

My workflow 7. Uses openAi, redis, httpRequest, agent. Webhook trigger; 77 nodes.

Webhook trigger★★★★★ complexityAI-powered77 nodesOpenAIRedisHTTP RequestAgentMemory Redis ChatOpenAI ChatNoco DbExecute Workflow Trigger
AI & RAG Trigger: Webhook Nodes: 77 Complexity: ★★★★★ AI nodes: yes Added:

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

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

Download .json
{
  "active": false,
  "connections": {
    "Form Me": {
      "main": [
        [],
        [
          {
            "node": "NocoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Handler": {
      "main": [
        [
          {
            "node": "Form Me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Data Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Type1": {
      "main": [
        [
          {
            "node": "Text Memory",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OpenAI1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Text1": {
      "main": [
        [
          {
            "node": "Compare Memories1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI1": {
      "main": [
        [
          {
            "node": "Image Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio Memory": {
      "main": [
        [
          {
            "node": "Get Memory 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Memory": {
      "main": [
        [
          {
            "node": "Get Memory 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Memory": {
      "main": [
        [
          {
            "node": "Get Memory 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Memory 2": {
      "main": [
        [
          {
            "node": "Combine Text1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Memory 1": {
      "main": [
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code1": {
      "main": [
        [
          {
            "node": "Loop Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Messages": {
      "main": [
        [],
        [
          {
            "node": "Send Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Message": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Memory": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Audio Memory",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 10s": {
      "main": [
        [
          {
            "node": "Get Memory 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "NocoDB": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Message Type1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NocoDB1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NocoDB1": {
      "main": [
        [
          {
            "node": "Message Type1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qualificacao": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Input Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get Id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Id1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Id": {
      "main": [
        [
          {
            "node": "Qualificado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Id1": {
      "main": [
        [
          {
            "node": "Desqualificado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agendamento": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Email": {
      "main": [
        [
          {
            "node": "Google Calendar",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Google Calendar1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "J\u00e1 tem evento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar1": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Google Calendar2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Id2": {
      "main": [
        [
          {
            "node": "Agendado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar2": {
      "main": [
        [
          {
            "node": "Get Id2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agendado": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email1": {
      "main": [
        [
          {
            "node": "Google Calendar3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar3": {
      "main": [
        [
          {
            "node": "If3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If3": {
      "main": [
        [
          {
            "node": "Google Calendar5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Id3": {
      "main": [
        [
          {
            "node": "Reagendamento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reagendamento": {
      "main": [
        [
          {
            "node": "Edit Fields5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar5": {
      "main": [
        [
          {
            "node": "Google Calendar4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar4": {
      "main": [
        [
          {
            "node": "Get Id3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reagendamento1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Email2": {
      "main": [
        [
          {
            "node": "Google Calendar7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Edit Fields6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar7": {
      "main": [
        [
          {
            "node": "Google Calendar6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Id4": {
      "main": [
        [
          {
            "node": "Cancelamento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Calendar6": {
      "main": [
        [
          {
            "node": "Get Id4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cancelamento": {
      "main": [
        [
          {
            "node": "Edit Fields7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cancelamento1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2025-06-28T03:55:48.358Z",
  "id": "MaFRq3hY77h6qVMH",
  "isArchived": true,
  "meta": null,
  "name": "My workflow 7",
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "94746291-c0f3-44f3-b635-1fe696d7d74e",
              "leftValue": "={{ $('Webhook').item.json.body.data.key.fromMe }}",
              "rightValue": "false",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "9d169d4d-14b6-48c8-9799-b6e7e9119522",
      "name": "Form Me",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -3280,
        1080
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "62f6e880-1cec-403c-83b4-91f80e517451",
              "name": "data.remoteJid",
              "value": "={{ $json.body.data.key.remoteJid }}",
              "type": "string"
            },
            {
              "id": "c6eb2538-aff4-44ec-ae16-8b970b0427a6",
              "name": "data.fromMe",
              "value": "={{ $json.body.data.key.fromMe }}",
              "type": "boolean"
            },
            {
              "id": "cf750274-b641-4532-b4bf-f2424c665acb",
              "name": "data.idMessage",
              "value": "={{ $json.body.data.key.id }}",
              "type": "string"
            },
            {
              "id": "8847d563-b0fd-44d6-b7cc-b6005f9cfff1",
              "name": "data.conversation",
              "value": "={{ $json.body.data.message.conversation }}",
              "type": "string"
            },
            {
              "id": "881bee20-c3ce-4eac-8c5c-aef2391bf751",
              "name": "data.messageType",
              "value": "={{ $json.body.data.messageType }}",
              "type": "string"
            },
            {
              "id": "b39c3487-e1ff-4e0c-8bec-e791e2fc929d",
              "name": "data.date_time",
              "value": "={{ $json.body.date_time }}",
              "type": "string"
            },
            {
              "id": "5432d11e-d514-4503-9748-84322c59de45",
              "name": "evo.instance",
              "value": "={{ $json.body.instance }}",
              "type": "string"
            },
            {
              "id": "189ea797-9a58-497a-a344-4035fca737af",
              "name": "evo.server_url",
              "value": "={{ $json.body.server_url }}",
              "type": "string"
            },
            {
              "id": "0e0adf45-3b63-4dd3-997a-93028594c2bc",
              "name": "evo.apikey",
              "value": "={{ $json.body.apikey }}",
              "type": "string"
            },
            {
              "id": "c0f65baf-d145-46e4-88fa-2bb410aa3e24",
              "name": "data.mediaUrl",
              "value": "={{ $json.body.data.message.mediaUrl }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -3460,
        1080
      ],
      "id": "22123c00-b366-4e3d-b723-fabdb0baec9a",
      "name": "Data Handler"
    },
    {
      "parameters": {
        "content": "# Texto, \u00c1udio, Imagem",
        "height": 860,
        "width": 880,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1860,
        640
      ],
      "typeVersion": 1,
      "id": "5991f983-492b-4683-b34c-e53a6084ed92",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "# Tratamento de Mensagens Fracionadas",
        "height": 360,
        "width": 1100,
        "color": 2
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -920,
        920
      ],
      "typeVersion": 1,
      "id": "92760e64-9a1d-4629-96b4-24a30785d2bc",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "pedroalmeida/messages-upsert",
        "options": {}
      },
      "id": "2456b624-c506-44f4-87eb-ff3d3a8ecc08",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -3520,
        1660
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "edcb5496-d743-4609-9cde-d45905a28868",
              "leftValue": "={{ $json.body.data.key.remoteJid }}",
              "rightValue": "@s.whatsapp.net",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        -3660,
        1080
      ],
      "id": "97c4296a-e678-4719-97c4-011d838141a6",
      "name": "Filter"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0cb14635-2673-408e-86db-ce9e0373674b",
                    "leftValue": "={{ $('Webhook').item.json.body.data.messageType }}",
                    "rightValue": "conversation",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Text"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('Webhook').item.json.body.data.messageType }}",
                    "rightValue": "audioMessage",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Audio"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "60065893-74f7-4b64-bc1a-d891202efa78",
                    "leftValue": "={{ $('Webhook').item.json.body.data.messageType }}",
                    "rightValue": "imageMessage",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Image"
            }
          ]
        },
        "options": {}
      },
      "id": "0b09ee05-c248-4a40-9f15-fd0e298af4dd",
      "name": "Message Type1",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -1940,
        1080
      ]
    },
    {
      "parameters": {
        "jsCode": "// Obter os arrays de mensagens dos n\u00f3s \"Get Memory 1\" e \"Get Memory 2\"\nconst Messages1 = $('Get Memory 2').item.json.Messages;\nconst Messages2 = $('Get Memory 1').item.json.Messages;\n\n// Combinar as strings dentro de cada array em uma \u00fanica string\nconst combinedText1 = Messages1.join(' ');\nconst combinedText2 = Messages2.join(' ');\n\n// Retornar os dois textos combinados como vari\u00e1veis separadas\nreturn {\n    combinedText1,\n    combinedText2\n};"
      },
      "id": "1fe703b4-a09b-4b43-8640-e435be5fe21c",
      "name": "Combine Text1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -260,
        1080
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "48eb879e-862a-46f5-95ec-6c244f4bfdc1",
              "leftValue": "={{ $json.combinedText1 }}",
              "rightValue": "={{ $json.combinedText2 }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        -40,
        1080
      ],
      "id": "0d914c6e-f9d9-4efd-a7f4-3ff4ef4b486c",
      "name": "Compare Memories1"
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "text": "o que est\u00e1 na imagem?",
        "imageUrls": "={{ $json.data.mediaUrl }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.6,
      "position": [
        -1600,
        1280
      ],
      "id": "986d9f92-06ce-4689-b889-f18e41e08f5a",
      "name": "OpenAI1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
        "messageData": "={{ $json.text }}",
        "tail": true
      },
      "id": "a3e5b481-b160-40cd-8e86-c7c7dbeef379",
      "name": "Audio Memory",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -1300,
        1080
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
        "messageData": "={{ $json.content }}",
        "tail": true
      },
      "id": "522db57a-3f24-41f8-a802-c256a16c4553",
      "name": "Image Memory",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -1380,
        1280
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
        "messageData": "={{ $('Webhook').item.json.body.data.message.conversation }}",
        "tail": true
      },
      "id": "7b8e3f18-c5c1-424a-995f-dacf46e3beeb",
      "name": "Text Memory",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -1500,
        840
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "propertyName": "Messages",
        "key": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
        "options": {}
      },
      "id": "f9d326b2-a7c9-49d6-8228-6edf0497a582",
      "name": "Get Memory 2",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -460,
        1080
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "propertyName": "Messages",
        "key": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
        "options": {}
      },
      "id": "8d74b3f6-80f8-411f-9fb2-758397a6eb76",
      "name": "Get Memory 1",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -860,
        1080
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "key": "={{ $item(\"0\").$node[\"Webhook\"].json[\"body\"][\"data\"][\"key\"][\"remoteJid\"] }}"
      },
      "id": "176ee480-9f92-4cdb-8854-654bbababe4b",
      "name": "Delete Memory",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        740,
        1080
      ],
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Obt\u00e9m a sa\u00edda do n\u00f3 \"AI Agent\"\nconst output = $('AI Agent').item.json.output;\n\n// Divide o texto em partes, usando dois espa\u00e7os entre linhas como delimitador\nconst splitOutput = output.split('\\n\\n');\n\n// Retorna o resultado como array de objetos\nreturn splitOutput.map(part => ({ result: part }));\n"
      },
      "id": "ff94a753-2d39-4a35-ba19-60da5aebcc02",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        1080
      ]
    },
    {
      "parameters": {
        "amount": 3
      },
      "id": "7b670edb-e5d1-437d-872a-65f9475a443a",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1580,
        1160
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "eef55cf0-a006-4ccb-8319-cd856fcbbc3f",
      "name": "Loop Messages",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        1220,
        1080
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $item(\"0\").$node[\"Data Handler\"].json[\"evo\"][\"server_url\"] }}/message/sendText/{{ $item(\"0\").$node[\"Data Handler\"].json[\"evo\"][\"instance\"] }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $item(\"0\").$node[\"Data Handler\"].json[\"evo\"][\"apikey\"] }}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "number",
              "value": "={{ $item(\"0\").$node[\"Webhook\"].json[\"body\"][\"data\"][\"key\"][\"remoteJid\"] }}"
            },
            {
              "name": "text",
              "value": "={{ $json.result }}"
            }
          ]
        },
        "options": {
          "redirect": {
            "redirect": {}
          }
        }
      },
      "id": "75667151-bb7b-434c-a2b1-1ed39508f3c6",
      "name": "Send Message",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1400,
        1160
      ]
    },
    {
      "parameters": {
        "content": "# Respostas Fracionadas",
        "height": 400,
        "width": 740,
        "color": 6
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        980
      ],
      "typeVersion": 1,
      "id": "a6878054-5349-45fc-b5f6-34baef032c54",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Mensagem usu\u00e1rio: {{ $json.chatInput }}\n\nHora da Mensagem: {{ $now.setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy TT\") }}",
        "options": {
          "systemMessage": "=### Identidade\n\nEu sou Novak, um agente de IA da Plas Digital especializado em automa\u00e7\u00e3o e intelig\u00eancia artificial. \n\nMinha fun\u00e7\u00e3o \u00e9 qualificar leads de forma inteligente, identificando suas necessidades no setor comercial das suas empresas e guia-los para entender como agentes IA no atendimento v\u00e3o reduzir custos, aumentar a produtividade e as vendas da empresa, e marcar reuni\u00f5es estrat\u00e9gicas com os leads qualificados para apresentar solu\u00e7\u00f5es. \n\nAdoto uma abordagem objetiva, direta e pr\u00e1tica, utilizando exemplos envolventes e dados concretos para mostrar o impacto das automa\u00e7\u00f5es nas vendas e no crescimento das empresas e sendo mais detalhado ao lidar com obje\u00e7\u00f5es.\n\n### Contexto\n\n1. Servi\u00e7o Oferecido: Implementa\u00e7\u00e3o de Agentes IA para automatizar o atendimento no WhatsApp e Instagram , nossa solu\u00e7\u00e3o \u00e9 adaptada ao seu setor, garantindo que o atendimento seja eficaz para seus clientes.\n 1.1 Funcionalidades Avan\u00e7adas:\n     - Nosso agente entende mensagens de \u00e1udio, imagens e documentos, algo que a maioria dos chatbots n\u00e3o oferece.\n     - Resposta em \u00c1udios, imagens ou documentos.\n     - Programados para lidar com as obje\u00e7\u00f5es mais comuns, ajudando a converter mais vendas.\n     - Al\u00e9m de adicionar diversas funcionalidades como integra\u00e7\u00e3o com CRM, com Agenda, Sites externos, follow up quando o lead para de responder ....\n   1.2 Problemas que resolve: \n- Lentid\u00e3o nas respostas ou mensagens n\u00e3o respondidas.\n- Incapacidade de atender 24 horas por dia.\n- Incapacidade de responder muitos clientes ao mesmo tempo\n- Altos custos operacionais com equipes de atendimento.\n- Inconsist\u00eancia no atendimento devido a estilos diferentes dos atendentes, -humor do atendente.\n- Sobrecarga com perguntas repetitivas (ex.: pre\u00e7o, hor\u00e1rio de funcionamento).\n- Perda de tempo com leads desqualificados.\n- Dificuldade em monitorar e gerar relat\u00f3rios detalhados de atendimento.\n- Tempo perdido compilando relat\u00f3rios manualmente.\n- Falta de integra\u00e7\u00e3o com sistemas como CRM ou agendas.\n- Treinamento de Equipe e gest\u00e3o de equipe\n- Altas mensalidades e cobran\u00e7a por n\u00famero de usu\u00e1rios ou mensagens, pois utilizamos ferramentas open source\n\n2. Como funciona:\n- Antes de apresentarmos uma proposta detalhada com valores e servi\u00e7os, realizamos duas reuni\u00f5es r\u00e1pidas com os potenciais clientes:\n  - Primeira reuni\u00e3o (20 a 30 minutos): Entendemos as necessidades do cliente, mostramos nossa metodologia e o potencial das automa\u00e7\u00f5es e IA para montar uma solu\u00e7\u00e3o personalizada.\n  - Segunda reuni\u00e3o (10 a 20 minutos): Apresentamos a proposta comercial com todos os detalhes e valores.\n\n3. Crit\u00e9rios de qualifica\u00e7\u00e3o (n\u00e3o informe isso ao usu\u00e1rio)\n - Faturar acima de R$ 30 mil reais\n - Ap\u00f3s qualificar o lead, obrigatoriamente chame a tool \"Qualificacao\"\n \n4. Caso precise de mais informa\u00e7\u00f5es sobre a Plas digital acesso sua base de conhecimento e acesso \"Doc Sobre Plas Digital\" e n\u00e3o cite o nome do documento na resposta\n\n5. Datas: \nHoje \u00e9: {{ $today.setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}\n- Amanh\u00e3 \u00e9: {{ $today.plus({ days: 1 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}\n- os pr\u00f3ximos dias em sequ\u00eancia s\u00e3o: {{ $today.plus({ days: 2 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}, {{ $today.plus({ days: 3 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}, {{ $today.plus({ days: 4 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}, {{ $today.plus({ days: 5 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}, {{ $today.plus({ days: 6 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}, {{ $today.plus({ days: 7 }).setLocale('pt-BR').toFormat(\"cccc, dd/MM/yyyy\") }}\n\n\n# INSTRU\u00c7\u00d5ES DE ATENDIMENTO\n\n1. Identifica\u00e7\u00e3o do lead\n   - Inicio a conversa me apresentando, saudando o lead e perguntando qual nome dele. \n   - Exemplo: Ol\u00e1 me chamo Novak e sou uma IA\n\n2. Identifica\u00e7\u00e3o Interesse\n  - Pergunto que ele busca relacionado a automa\u00e7\u00e3o e intelig\u00eancia artificial\n - Logo ap\u00f3s pergunto o nicho da empresa dele\n\n3. Listo Benef\u00edcios das IAs \n - Mostre os benef\u00edcios dos servi\u00e7os da Plas para resolver o problema da empresa dele personalizando para o nicho\n\n4. D\u00favidas\n - Caso clientes tenha d\u00favidas, esclare\u00e7a. \n - Se for sobre o servi\u00e7o da plas, de uma resposta resumida e convide para reuni\u00e3o\n\n5. Convite para a A\u00e7\u00e3o:\n  - Sempre fa\u00e7a convite para uma reuni\u00e3o de apresenta\u00e7\u00e3o antes de ir para qualifica\u00e7\u00e3o\n\n6. Alinhamento e Qualifica\u00e7\u00e3o\n- Passo 1: Informo ao lead que, antes de prosseguir, gostaria de fazer algumas perguntas r\u00e1pidas para entender melhor o neg\u00f3cio dele e oferecer uma solu\u00e7\u00e3o personalizada.\n- Nunca fa\u00e7o mais de uma pergunta por vez. Sempre fa\u00e7o uma pergunta por vez e aguardo a resposta antes de prosseguir para a pr\u00f3xima.\n  - Pergunta 1: Pergunto o ramo de atua\u00e7\u00e3o do lead, a menos que ele j\u00e1 tenha mencionado essa informa\u00e7\u00e3o anteriormente.\n-  Pergunta 2: Pergunto quantas pessoas fazem parte do time de vendas e atendimento na empresa, caso ainda n\u00e3o tenha essa informa\u00e7\u00e3o.\n- Pergunta 3: Pergunto o faturamento m\u00e9dio mensal da empresa, se essa informa\u00e7\u00e3o ainda n\u00e3o foi fornecida.\n-  Ap\u00f3s coletar nicho, faturamento e equipe de atendimento, eu devo qualificar o lead de acordo com o crit\u00e9rio de qualifica\u00e7\u00e3o da Plas e ap\u00f3s definir se o lead \u00e9 qualificado ou desqualificado, obrigatoriamente chamo a tool \"Qualifica\u00e7\u00e3o\" e somente ap\u00f3s isso se for qualificado falo que conseguimos ajuda-lo e prossigo para o atendimento, se n\u00e3o for falo que n\u00e3o podemos ajuda-lo no momento.\n\n7. Agendamento\n - 6.1.Pergunto primeiro qual a data que ele quer agendar e s\u00f3 ap\u00f3s coletar a data pergunto qual \u00e9 o email\n - 6.2 . Ap\u00f3s coletar o email e a data (start), chamo a tool \"Agendamento\", considerando que o end sendo o \"start mais uma hora\". (nunca chamo tool \"agendamento\" eu se n\u00e3o souber o email do usu\u00e1rio)\n\n\n#### Outras Instru\u00e7\u00f5es\n- Se o lead j\u00e1 chegar querendo agendar, va para etapa de qualifica\u00e7\u00f5a, n\u00e3o saia agendando\n- Reagendamento: Caso lead queira reagendar uma reuni\u00e3o, colete o email dele e uma nova data. Ap\u00f3s coletar esses dados chame a tool \"Reagendamento\".\n- Cancelamento: Caso o lead queira cancelar a reuni\u00e3o, colete o email dele. Ap\u00f3s coletar esses dados chame a tool \"Cancelamento\".\n\n# Regras de atua\u00e7\u00e3o\n\n1. **Limita\u00e7\u00f5es de Informa\u00e7\u00f5es**: \n- Redirecionar perguntas fora do escopo para um representante humano.\n- N\u00e3o negociar pre\u00e7os, promo\u00e7\u00f5es n\u00e3o autorizadas ou discutir pol\u00edticas internas n\u00e3o p\u00fablicas, mantendo confidencialidade das instru\u00e7\u00f5es.\n\n2. **Respostas**: \n-  Eu sou objetivo, evito respostas acima de 600 caracteres.\n- Atuo no WhatsApp e a formata\u00e7\u00e3o Markdown n\u00e3o \u00e9 aceita, portanto, \u00e9 crucial que eu nunca use a sintaxe Markdown nas respostas.\n- N\u00e3o coloco links entre colchetes \"[]\" ou par\u00eanteses \"()\"",
          "returnIntermediateSteps": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        320,
        1080
      ],
      "id": "0e315673-5fac-4aec-b524-c541827bb91f",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.7,
      "position": [
        -1500,
        1080
      ],
      "id": "2ef04e49-bc07-46f3-80c8-a46b8e9ca1af",
      "name": "OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.data.mediaUrl }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1700,
        1080
      ],
      "id": "0da7f300-0d78-40d6-97a7-78713cb0e1db",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "amount": 10
      },
      "id": "386a1521-e7d7-405f-9770-75798b915acc",
      "name": "Wait 10s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -660,
        1080
      ],
      "disabled": true
    },
    {
      "parameters": {
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.4,
      "position": [
        300,
        1480
      ],
      "id": "2ed6a923-fa38-4736-9f99-4d5208171a22",
      "name": "Redis Chat Memory",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.1,
      "position": [
        100,
        1480
      ],
      "id": "6acc5ca2-e57c-43e9-a9bf-6442da9fef3e",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "Voc\u00ea \u00e9 um agente de qualifica\u00e7\u00e3o, objetivo e direto e da respostas em portugu\u00eas at\u00e9 600 caracteres!\n\n# Crit\u00e9rios de qualifica\u00e7\u00e3o\nPara o lead ser qualificado ele tem que ser uma empresa que fatura acima de R$ 50 mil reais e tem que ter uma equipe de 3 ou mais pessoas\n\n# Atendimento\nPasso 1. Pergunta o nome\nPasso 2. Pergunta o nicho\nPasso 3. Pergunta o Faturamento\nPasso 4. Pergunta o tamanho da equipe\nPasso 5. Ap\u00f3s coletar as informa\u00e7\u00f5es, qualifique o leads de acordo com o crit\u00e9rio de qualifica\u00e7\u00e3o. Se o lead for qualificado chame a tool \"Lead_Qualificado\" e informe que podemos atende-lo. Se o lead for desqualificado chame a tool \"Lead_Desqualificado\" e informe que podemos n\u00e3o podemos atende-lo.\n",
        "height": 220,
        "width": 720
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -100
      ],
      "typeVersion": 1,
      "id": "1c69c888-6211-4e26-b0ca-4b7aabed00b0",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "getAll",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "limit": 1,
        "options": {
          "where": "=(Telefone,like,{{ $('Data Handler').item.json.data.remoteJid.replaceAll('@s.whatsapp.net', '') }})"
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        -3060,
        1100
      ],
      "id": "9d090959-1630-457d-b1ed-0c2ec1daf64c",
      "name": "NocoDB",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "6ea55739-e33a-4f0d-95fb-13f6b1d6c8e8",
              "leftValue": "={{ $json.Telefone }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -2660,
        1100
      ],
      "id": "7b97bd45-2470-451a-9151-74cd9f16e853",
      "name": "If"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "create",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldName": "Telefone",
              "fieldValue": "={{ $('Data Handler').item.json.data.remoteJid.replaceAll('@s.whatsapp.net', '') }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        -2260,
        1220
      ],
      "id": "ebcc6fe2-d31e-495a-8fe6-05204474dd59",
      "name": "NocoDB1"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        -2840,
        1100
      ],
      "id": "9fa0e555-5e2a-4a10-8837-61089237f7cd",
      "name": "Limit"
    },
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "telefone"
            },
            {
              "name": "nome"
            },
            {
              "name": "evento"
            },
            {
              "name": "nicho"
            },
            {
              "name": "faturamento"
            },
            {
              "name": "equipe"
            },
            {
              "name": "start"
            },
            {
              "name": "end"
            },
            {
              "name": "email"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        440,
        2480
      ],
      "id": "914cad83-9717-46db-a89a-3bbdbbc11563",
      "name": "Workflow Input Trigger"
    },
    {
      "parameters": {
        "name": "Qualificacao",
        "description": "Chamo essa tool ap\u00f3s identificar se o lead \u00e9 qualificado ou desqualificado\n\nFaturamento preencha apenas o valor\nEquipe preencha apenas com o numero\n",
        "workflowId": {
          "__rl": true,
          "value": "={{ $workflow.id }}",
          "mode": "id"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "telefone": "=5521998105076",
            "nome": "={{ $fromAI(\"nome\", \"Nome do lead\") }}",
            "evento": "={{ $fromAI(\"evento\", \"Desqualificado ou Qualificado\") }}",
            "nicho": "={{ $fromAI(\"nicho\") }}",
            "faturamento": "={{ $fromAI(\"faturamento\", \"exemplo, 300 mil, 1 meilh\u00e3o\") }}",
            "equipe": "={{ $fromAI(\"equipe\", \"somente o n\u00famero de pessoas\") }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "telefone",
              "displayName": "telefone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "nome",
              "displayName": "nome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "evento",
              "displayName": "evento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "nicho",
              "displayName": "nicho",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "faturamento",
              "displayName": "faturamento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "equipe",
              "displayName": "equipe",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2,
      "position": [
        460,
        1480
      ],
      "id": "defdab29-6a63-4b8b-a3e5-e8d32967c1ca",
      "name": "Qualificacao"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.evento }}",
                    "rightValue": "Qualificado",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Qualificado"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "500fa7a6-a7cd-4b49-9b48-4ea748a06475",
                    "leftValue": "={{ $json.evento }}",
                    "rightValue": "Desqualificado",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Desqualificado"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "cca70790-bb07-41e3-9b9a-49173dcc10cb",
                    "leftValue": "={{ $json.evento }}",
                    "rightValue": "Agendamento",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Agendamento"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "57ef15f7-4b27-4fc3-a78f-819b02b7e692",
                    "leftValue": "={{ $json.evento }}",
                    "rightValue": "Reagendamento",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Reagendamento"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "28c8cc44-e02e-4c5e-8f82-40ed35a4f429",
                    "leftValue": "={{ $json.evento }}",
                    "rightValue": "Cancelamento",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Cancelamento"
            }
          ]
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        700,
        2440
      ],
      "id": "e345435e-1341-4b87-b92b-1205bc508c5e",
      "name": "Switch"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -160,
        1560
      ],
      "id": "be0d0b37-9af5-4f7d-b0fd-2b8d7446fa51",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "getAll",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "limit": 1,
        "options": {
          "where": "=(Telefone,like,{{ $('Workflow Input Trigger').item.json.telefone }})"
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        1200,
        1820
      ],
      "id": "14c736e9-6d69-48f2-baf0-70769067001c",
      "name": "Get Id"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "update",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldName": "Id",
              "fieldValue": "={{ $json.Id }}"
            },
            {
              "fieldName": "Nome",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.nome }}"
            },
            {
              "fieldName": "Status",
              "fieldValue": "Qualificado"
            },
            {
              "fieldName": "Nicho",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.nicho }}"
            },
            {
              "fieldName": "Faturamento",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.faturamento }}"
            },
            {
              "fieldName": "Equipe",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.equipe }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        1400,
        1820
      ],
      "id": "f8b40e02-e770-4a5f-bcab-cd1a7e7c050f",
      "name": "Qualificado"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "getAll",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "limit": 1,
        "options": {
          "where": "=(Telefone,like,{{ $('Workflow Input Trigger').item.json.telefone }})"
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        1200,
        2100
      ],
      "id": "bef933ad-5040-491d-996a-81dad65cf3e3",
      "name": "Get Id1"
    },
    {
      "parameters": {
        "authentication": "nocoDbApiToken",
        "operation": "update",
        "projectId": "pqi27voyd647fyy",
        "table": "mk99c8lngjjjat3",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldName": "Id",
              "fieldValue": "={{ $json.Id }}"
            },
            {
              "fieldName": "Nome",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.nome }}"
            },
            {
              "fieldName": "Status",
              "fieldValue": "Perdido"
            },
            {
              "fieldName": "Nicho",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.nicho }}"
            },
            {
              "fieldName": "Faturamento",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.faturamento }}"
            },
            {
              "fieldName": "Equipe",
              "fieldValue": "={{ $('Workflow Input Trigger').item.json.equipe }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [
        1420,
        2100
      ],
      "id": "4dccee67-d9e2-40ca-9e47-74dd4b6113cf",
      "name": "Desqualificado"
    },
    {
      "parameters": {
        "name": "Agendamento",
        "description": "Chame essa tool para agenar a reuni\u00e3o",
        "workflowId": {
          "__rl": true,
          "value": "={{ $workflow.id }}",
          "mode": "id"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "telefone": "5521998105076",
            "nome": "={{ $fromAI(\"nome\") }}",
            "start": "={{ $fromAI(\"start\", \"data hora do inicio da reuni\u00e3o, no seguinte formato: 2024-10-18T14:30:00-03:00\") }}",
            "end": "={{ $fromAI(\"end\", \"data hora do fim da reuni\u00e3o que \u00e9 o Start mais 1 hora, no seguinte formato: 2024-10-18T15:30:00-03:00\") }}",
            "email": "={{ $fromAI(\"email\") }}",
            "evento": "Agendamento"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "telefone",
              "displayName": "telefone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "nome",
              "displayName": "nome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "evento",
              "displayName": "evento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "nicho",
              "displayName": "nicho",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": true
            },
            {
              "id": "faturamento",
              "displayName": "faturamento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": true
            },
            {
              "id": "equipe",
              "displayName": "equipe",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": true
            },
            {
              "id": "start",
              "displayName": "start",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "end",
              "displayName": "end",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2,
      "position": [
        600,
        1480
      ],
      "id": "183d32b2-9034-4920-8f27-5773f6039b45",
      "name": "Agendamento"
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "plasdigital1@gmail.com",
          "mode": "list",
          "cachedResultName": "plasdigital1@gmail.com"
        },
        "limit": 3,
        "options": {
          "timeMin": "={{ $now }}",
          "query": "={{ $('Workflow Input Trigger').item.json.email }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.2,
      "position": [
        1400,
        2380
      ],
      "id": "be1e20cf-d2d6-450c-b530-b0d308dd293f",
      "name": "Google Calendar",
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "bd29257c-af72-4e25-aba0-65c8f810932e",
              "leftValue": "={{ $json.email.isEmail() }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1180,
        2480
      ],
      "id": "0e10d34a-7ebf-4b2b-aad7-229ee174537a",
      "name": "Email"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "00badf83-ee8f-4428-9944-5804eb54afc7",
              "name": "response",
              "value": "Solicite o email para fazer o agendamento, e ap\u00f3s coletar email e data, cchame a tool agendamento novamente",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1380,
        2560
      ],
      "id": "90936692-6a57-4219-bd4d-098046fbcd1b",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
        

Credentials you'll need

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

Pro

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

How this works

This workflow automates handling of incoming form submissions through a webhook, using OpenAI to analyse and respond to messages while storing context in Redis for continuity. It suits teams managing high-volume customer enquiries or support requests that need consistent, context-aware replies without manual intervention. The key step involves the agent combining OpenAI reasoning with Redis memory to maintain conversation history across multiple exchanges.

Use it when you need reliable AI-driven responses tied to structured data inputs, but avoid it for one-off queries or when data privacy rules prohibit external AI processing. Common variations include swapping the form trigger for email or adjusting the OpenAI prompt to focus on sales rather than support.

About this workflow

My workflow 7. Uses openAi, redis, httpRequest, agent. Webhook trigger; 77 nodes.

Source: https://github.com/fer336/workback/blob/328a48f11b1e3d69b6c7a911b4269e5d6497480b/workflows/RG5BPBnebfM3AUrR.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

My workflow 7. Uses openAi, redis, httpRequest, agent. Webhook trigger; 77 nodes.

OpenAI, Redis, HTTP Request +8
AI & RAG

B.IA-v.0.4.0. Uses agent, lmChatGroq, n8n-nodes-evolution-api, redis. Webhook trigger; 59 nodes.

Agent, Groq Chat, N8N Nodes Evolution Api +8
AI & RAG

Agent: IPTV (instance_e2165d22_1762376395079). Uses openAi, redis, supabase, httpRequest. Webhook trigger; 56 nodes.

OpenAI, Redis, Supabase +7
AI & RAG

1-[Agente-Abogado]-Asistente-Whatsapp. Uses lmChatOpenAi, toolWorkflow, toolCalculator, agent. Webhook trigger; 52 nodes.

OpenAI Chat, Tool Workflow, Tool Calculator +8
AI & RAG

[Agente-Abogado]-Asistente-Whatsapp. Uses lmChatOpenAi, toolWorkflow, memoryPostgresChat, toolCalculator. Webhook trigger; 51 nodes.

OpenAI Chat, Tool Workflow, Memory Postgres Chat +8