AutomationFlowsAI & RAG › Agente Instagram

Agente Instagram

Agente Instagram. Uses httpRequest, googleGemini, lmChatGoogleGemini, memoryBufferWindow. Webhook trigger; 14 nodes.

Webhook trigger★★★★☆ complexityAI-powered14 nodesHTTP RequestGoogle GeminiGoogle Gemini ChatMemory Buffer WindowAgent
AI & RAG Trigger: Webhook Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Googlegemini 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
{
  "name": "Agente Instagram",
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "f1a2b3c4-0007-4a11-8a01-000000000007",
              "leftValue": "={{ $json.body.entry[0].messaging[0].message.is_echo }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        224,
        320
      ],
      "id": "52cd588b-daab-4f34-8b51-698f6a32ee51",
      "name": "Ignora mensagens do pr\u00f3prio bot (echo)"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.body.entry[0].messaging[0].message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "id": "f1a2b3c4-0009-4a11-8a01-000000000009"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Texto"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 3
                },
                "conditions": [
                  {
                    "id": "f1a2b3c4-0010-4a11-8a01-000000000010",
                    "leftValue": "={{ $json.body.entry[0].messaging[0].message.attachments[0].type }}",
                    "rightValue": "audio",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\u00c1udio"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.4,
      "position": [
        448,
        320
      ],
      "id": "8df2d968-254c-4a3e-aed1-7af2c143b1b9",
      "name": "Identifica se \u00e9 texto ou \u00e1udio"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f1a2b3c4-0012-4a11-8a01-000000000012",
              "name": "MensagemChat",
              "value": "={{ $('Webhook (Recebe a mensagem Instagram)').item.json.body.entry[0].messaging[0].message.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        688,
        128
      ],
      "id": "bcb7f9c4-d4a1-4a62-9f3d-d3b0920203ac",
      "name": "Guarda a mensagem de texto"
    },
    {
      "parameters": {
        "url": "={{ $json.body.entry[0].messaging[0].message.attachments[0].payload.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        688,
        464
      ],
      "id": "396f748d-df4e-41e6-ba9f-13971373222c",
      "name": "Busca o arquivo de \u00e1udio"
    },
    {
      "parameters": {
        "resource": "audio",
        "modelId": {
          "__rl": true,
          "value": "models/gemini-3-flash-preview",
          "mode": "list",
          "cachedResultName": "models/gemini-3-flash-preview"
        },
        "inputType": "binary",
        "simplify": false,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1.2,
      "position": [
        912,
        464
      ],
      "id": "6f5a8e1f-c601-48f0-aa39-03680b16cb23",
      "name": "Transcreve o \u00e1udio",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f1a2b3c4-0016-4a11-8a01-000000000016",
              "name": "MensagemChat",
              "value": "={{ $json.candidates[0].content.parts[0].text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.5,
      "position": [
        1120,
        464
      ],
      "id": "99501292-9d9e-48d1-80ac-b9a9f20f4f45",
      "name": "Guarda a mensagem transcrita"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1.1,
      "position": [
        1360,
        464
      ],
      "id": "ee7e5a2d-037d-4cef-ad2f-acfc24250a73",
      "name": "Google Gemini",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Webhook (Recebe a mensagem Instagram)').item.json.body.entry[0].messaging[0].sender.id }}",
        "contextWindowLength": 30
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.4,
      "position": [
        1520,
        464
      ],
      "id": "86a8576b-6862-4bd2-829f-9ff480874f0d",
      "name": "Banco de dados"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "1ef2edc0-2b96-4e34-bd47-0f54a58c78f6",
              "leftValue": "={{ $json.query['hub.challenge'] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            },
            {
              "id": "25e459f2-b4b8-49ee-ba73-08b2fd3c4893",
              "leftValue": "={{ $json.query['hub.verify_token'] }}",
              "rightValue": "marykay2026",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -240,
        176
      ],
      "id": "142afc56-becc-4197-b849-982972351844",
      "name": "Verifica se \u00e9 mensagem da Meta ou Usu\u00e1rio"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"status\": \"EVENT_RECEIVED\" } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        0,
        320
      ],
      "id": "3edb3084-e24d-4e34-be32-3e96ed41d44e",
      "name": "Confirma Recebimento do Usu\u00e1rio"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.MensagemChat }}",
        "options": {
          "systemMessage": "[IDENTIDADE E PERSONA]\nVoc\u00ea \u00e9 a D\u00e9bora, uma Consultora de Beleza Mary Kay virtual. Sua personalidade \u00e9 profissional, elegante, direta e altamente capacitada. Voc\u00ea atende de forma cordial e sofisticada, mas vai direto ao ponto.\nRestri\u00e7\u00f5es de Tom de Voz: N\u00e3o seja excessivamente informal, evite ser \"melosa\" e utilize emojis com extrema modera\u00e7\u00e3o (m\u00e1ximo de 1 ou 2 por mensagem, se estritamente necess\u00e1rio).\n\n[OBJETIVO PRINCIPAL]\nVoc\u00ea \u00e9 a \u00fanica respons\u00e1vel por conduzir o atendimento da cliente do in\u00edcio ao fim. Sua miss\u00e3o \u00e9 tirar d\u00favidas sobre produtos, recomendar rotinas de cuidados com a pele ou maquiagem, explicar o processo de compra e direcionar a cliente para finalizar o pedido no link oficial.\n\n[REGRAS DE CONHECIMENTO E PRODUTOS]\n\nFidelidade Estrita \u00e0 Marca: TODAS as suas informa\u00e7\u00f5es, recomenda\u00e7\u00f5es, ingredientes e benef\u00edcios devem ser baseados EXCLUSIVAMENTE no portf\u00f3lio oficial da Mary Kay Brasil.\n\nProibi\u00e7\u00e3o de Alucina\u00e7\u00e3o (Toler\u00e2ncia Zero): Nunca invente um produto, uma linha, uma cor de base ou um benef\u00edcio milagroso. Se n\u00e3o tiver certeza absoluta se o produto existe na Mary Kay, n\u00e3o recomende e sugira uma alternativa real do cat\u00e1logo.\n\nConsultoria Personalizada: Indique produtos espec\u00edficos para necessidades reais (pele oleosa, seca, com acne, madura), sugira ordens de uso corretas (ex: rotina TimeWise) e d\u00ea dicas de aplica\u00e7\u00e3o, demonstrando autoridade no assunto.\n\n[REGRAS DE VENDA, PAGAMENTO E LOG\u00cdSTICA]\n\nModelo de Neg\u00f3cio: Voc\u00ea N\u00c3O recebe pagamentos diretos (nunca aceite Pix, transfer\u00eancia ou dinheiro f\u00edsico) e N\u00c3O faz entregas em m\u00e3os. Todo o processo financeiro e log\u00edstico \u00e9 feito pela Mary Kay.\n\nInstru\u00e7\u00f5es de Compra e Link Oficial: Aguarde a cliente definir os produtos que deseja. SOMENTE quando ela demonstrar inten\u00e7\u00e3o real de finalizar a compra (ex: \"quero comprar\", \"como eu pago?\", \"vou levar esse\"), explique que a compra \u00e9 segura direto no site e envie o link de compra exato: https://www.marykay.com.br\n\nRegra Anti-Repeti\u00e7\u00e3o (MUITO IMPORTANTE): Envie as regras de pagamento, log\u00edstica e o link APENAS UMA VEZ no momento em que a cliente for fechar o pedido. N\u00c3O repita essas informa\u00e7\u00f5es operacionais e n\u00e3o mande o link novamente em mensagens seguintes, a menos que a cliente fa\u00e7a uma nova pergunta direta sobre pagamento ou perca o link.\n\nFormata\u00e7\u00e3o do Link: Para garantir que o link seja clic\u00e1vel no Instagram, envie sempre no formato puro com https, sem aspas, sem pontos finais grudados e sem colchetes. Exatamente assim: https://www.marykay.com.br\n\n[REGRAS DE COMUNICA\u00c7\u00c3O E COMPORTAMENTO]\n\nSauda\u00e7\u00e3o \u00danica: Se a cliente mandar apenas \"Oi\", \"Bom dia\" ou algo similar, apresente-se rapidamente (\"Ol\u00e1, sou a D\u00e9bora, sua Consultora Mary Kay. Como posso ajudar com sua rotina de beleza hoje?\"). Importante: Analise o hist\u00f3rico da conversa. Apresente-se APENAS na primeira mensagem. Nas intera\u00e7\u00f5es seguintes, continue o assunto naturalmente.\n\nFormata\u00e7\u00e3o Mobile: Suas respostas ser\u00e3o lidas em telas de celular. Seja sempre clara e objetiva em mensagens curtas. Suas respostas nunca podem ultrapassar o limite m\u00e1ximo de 800 caracteres. Se a explica\u00e7\u00e3o for longa, resuma os pontos principais.\n\nFuga de Escopo: Se a cliente fizer perguntas sobre pol\u00edtica, assuntos pol\u00eamicos ou qualquer tema que n\u00e3o seja relacionado a beleza, cuidados com a pele ou produtos Mary Kay, recuse-se educadamente a responder e redirecione o foco para a consultoria de beleza.\n\n[REGRAS DE VENDA, PAGAMENTO E LOG\u00cdSTICA]\n\nModelo de Neg\u00f3cio: Voc\u00ea N\u00c3O recebe pagamentos diretos (nunca aceite Pix, transfer\u00eancia ou dinheiro f\u00edsico) e N\u00c3O faz entregas em m\u00e3os. Todo o processo financeiro e log\u00edstico \u00e9 feito pela Mary Kay.\n\nInstru\u00e7\u00f5es de Compra e Link Oficial: Aguarde a cliente definir os produtos que deseja. SOMENTE quando ela demonstrar inten\u00e7\u00e3o real de finalizar a compra (ex: \"quero comprar\", \"como eu pago?\", \"vou levar esse\"), explique que a compra \u00e9 segura direto no site e envie o link de compra exato: loja.marykay.com.br\n\nRegra Anti-Repeti\u00e7\u00e3o (MUITO IMPORTANTE): Envie as regras de pagamento, log\u00edstica e o link APENAS UMA VEZ no momento em que a cliente for fechar o pedido. N\u00c3O repita essas informa\u00e7\u00f5es operacionais e n\u00e3o mande o link novamente em mensagens seguintes, a menos que a cliente fa\u00e7a uma nova pergunta direta sobre pagamento ou perca o link. \n\n[REGRAS DE FORMATA\u00c7\u00c3O PARA O INSTAGRAM]\n\n1. Proibi\u00e7\u00e3o de Markdown: O chat do Instagram N\u00c3O suporta negrito ou it\u00e1lico. NUNCA utilize asteriscos (**) ou outros s\u00edmbolos de formata\u00e7\u00e3o de texto em suas respostas.\n\n2. Link Curto e Isolado: Para evitar que o link quebre na tela do celular e perca o clique, envie SEMPRE exatamente como \"loja.marykay.com.br\". O link DEVE estar em uma linha absolutamente sozinha, com uma quebra de linha antes e outra depois. \nExemplo obrigat\u00f3rio de como a mensagem deve ficar:\n\n\"Para finalizar seu pedido de forma segura, acesse a nossa loja oficial:\n\nloja.marykay.com.br\n\nQualquer d\u00favida durante a compra, estou aqui!\""
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1360,
        192
      ],
      "id": "c9182d70-1d5b-4905-a349-bb2cbdd18160",
      "name": "Agente IA"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://graph.facebook.com/v21.0/me/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ recipient: { id: $('Webhook (Recebe a mensagem Instagram)').item.json.body.entry[0].messaging[0].sender.id }, message: { text: $json.output } }) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1664,
        192
      ],
      "id": "cc954105-dd57-49e4-be34-41f5b3e1f41c",
      "name": "Responde mensagem Instagram",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "={{ $json.query['hub.challenge'] }}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "6c9a3c6e-e75b-45fa-9995-96f5e20b1d5f",
      "name": "Confirma se a mensagem \u00e9 da Meta"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "instagram-webhook",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -464,
        176
      ],
      "id": "309f49af-80f0-4ec0-8824-6d853f375895",
      "name": "Webhook (Recebe a mensagem Instagram)"
    }
  ],
  "connections": {
    "Ignora mensagens do pr\u00f3prio bot (echo)": {
      "main": [
        [
          {
            "node": "Identifica se \u00e9 texto ou \u00e1udio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Identifica se \u00e9 texto ou \u00e1udio": {
      "main": [
        [
          {
            "node": "Guarda a mensagem de texto",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Busca o arquivo de \u00e1udio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Busca o arquivo de \u00e1udio": {
      "main": [
        [
          {
            "node": "Transcreve o \u00e1udio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcreve o \u00e1udio": {
      "main": [
        [
          {
            "node": "Guarda a mensagem transcrita",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guarda a mensagem transcrita": {
      "main": [
        [
          {
            "node": "Agente IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guarda a mensagem de texto": {
      "main": [
        [
          {
            "node": "Agente IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini": {
      "ai_languageModel": [
        [
          {
            "node": "Agente IA",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Banco de dados": {
      "ai_memory": [
        [
          {
            "node": "Agente IA",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Verifica se \u00e9 mensagem da Meta ou Usu\u00e1rio": {
      "main": [
        [
          {
            "node": "Confirma se a mensagem \u00e9 da Meta",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Confirma Recebimento do Usu\u00e1rio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confirma Recebimento do Usu\u00e1rio": {
      "main": [
        [
          {
            "node": "Ignora mensagens do pr\u00f3prio bot (echo)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agente IA": {
      "main": [
        [
          {
            "node": "Responde mensagem Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook (Recebe a mensagem Instagram)": {
      "main": [
        [
          {
            "node": "Verifica se \u00e9 mensagem da Meta ou Usu\u00e1rio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "4d6f20fa-7656-4ca3-9067-204ee37fe381",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodeGroups": [],
  "id": "5gEcyGX8WAzIsjdD",
  "tags": []
}

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

About this workflow

Agente Instagram. Uses httpRequest, googleGemini, lmChatGoogleGemini, memoryBufferWindow. Webhook trigger; 14 nodes.

Source: https://github.com/pachecorenato/agente-ia-instagram-n8n/blob/main/agente_instagram.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

Arvifund - Supabase (Fixed v6). Uses httpRequest, telegram, supabase, telegramTrigger. Event-driven trigger; 92 nodes.

HTTP Request, Telegram, Supabase +8
AI & RAG

Arvifund - Supabase (Fixed v5). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 91 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase. Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +8
AI & RAG

Arvifund - Supabase (Fixed v2). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9
AI & RAG

Arvifund - Supabase (Fixed v4). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.

HTTP Request, Telegram, Google Sheets +9