Seguimiento de respuestas a comentarios de Instagram automatizadas con Hojas de Cálculo de Google y CRM

Intermedio

Este es unSocial Mediaflujo de automatización del dominio deautomatización que contiene 11 nodos.Utiliza principalmente nodos como If, Switch, Webhook, HttpRequest, GoogleSheets. Automatizar el seguimiento de respuestas a comentarios de Instagram con Google Sheets y CRM

Requisitos previos
  • Punto final de HTTP Webhook (n8n generará automáticamente)
  • Pueden requerirse credenciales de autenticación para la API de destino
  • Credenciales de API de Google Sheets

Categoría

Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "40e2ddc17723de14c7d0537f9006dd246a3f4df33df6ca7f746ccb612d5f27b9"
  },
  "nodes": [
    {
      "id": "b6b07e6a-5605-4991-bc5d-bd108ee503e5",
      "name": "Insta Update",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -100,
        900
      ],
      "webhookId": "eae5550b-f362-46d8-9b51-79aaaefd8d7b",
      "parameters": {
        "path": "instagram",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "ac3030e7-adda-4432-9846-fc214bfdda4a",
      "name": "Send Message for Comment",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        860,
        900
      ],
      "parameters": {
        "url": "=https://graph.instagram.com/v23.0/{{ $('Check if update is of comment?').item.json.body.entry[0].id }}/messages",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "jsonBody": "={\n  \"recipient\": {\n    \"id\": \"{{ $('Check if update is of comment?').item.json.body.entry[0].changes[0].value.from.id }}\"\n  },\n  \"message\": {\n    \"text\": \"{{ $json.Message }}\"\n  }\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "0SD8qdsV8SjyC0bo",
          "name": "IG Access Token"
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.2,
      "waitBetweenTries": 3000
    },
    {
      "id": "800da6b1-b7e4-4939-8d3c-5af3a55fffca",
      "name": "Comment List",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        640,
        900
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.body.entry[0].changes[0].value.text.split()[0].toLowerCase() }}",
              "lookupColumn": "Comment"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA/edit?usp=drivesdk",
          "cachedResultName": "IG Comment Reply"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9NL9w5d9bKz7xt16",
          "name": "Akash Google Sheet Account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.6,
      "waitBetweenTries": 3000
    },
    {
      "id": "c7877403-33f3-4e3c-a490-6a4e6844ecf9",
      "name": "Get Verification",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -100,
        600
      ],
      "webhookId": "eae5550b-f362-46d8-9b51-79aaaefd8d7b",
      "parameters": {
        "path": "instagram",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "5cddd607-4639-48eb-922a-a743736de52b",
      "name": "Respond to Verification Message",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        120,
        600
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.query[\"hub.challenge\"] }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "c87053c2-8508-4199-9c87-49d19b3b9cb1",
      "name": "Add Interaction in Sheet (CRM)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        900
      ],
      "parameters": {
        "columns": {
          "value": {
            "Note": "={{ $json?.error.message }}",
            "Time": "={{ $('Check if update is of comment?').item.json.body.entry[0].time }}",
            "User Id": "={{ $('Check if update is of comment?').item.json.body.entry[0].changes[0].value.from.id }}",
            "Username": "={{ $('Check if update is of comment?').item.json.body.entry[0].changes[0].value.from.username }}"
          },
          "schema": [
            {
              "id": "Time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "User Id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "User Id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Note",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "useAppend": true
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 76673878,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA/edit#gid=76673878",
          "cachedResultName": "Interation List"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1tQwit0eRrR5N-EoLX4dyXurjEDtthsr97Vny9kaIRdA/edit?usp=drivesdk",
          "cachedResultName": "IG Comment Reply"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9NL9w5d9bKz7xt16",
          "name": "Akash Google Sheet Account"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.6,
      "waitBetweenTries": 3000
    },
    {
      "id": "45da4261-9d50-43e7-b76a-7abc49bb05c6",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        500
      ],
      "parameters": {
        "color": 3,
        "width": 520,
        "height": 280,
        "content": "## Section 1"
      },
      "typeVersion": 1
    },
    {
      "id": "466854cc-015e-45e1-9df9-719b1c85f756",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        820
      ],
      "parameters": {
        "color": 5,
        "width": 1480,
        "height": 300,
        "content": "## Section 2\n"
      },
      "typeVersion": 1
    },
    {
      "id": "96d3b6a2-7c39-4df1-8320-c9112c9ce91b",
      "name": "Check if update is of comment?",
      "type": "n8n-nodes-base.switch",
      "position": [
        120,
        900
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Comment",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "46743704-1feb-42f4-ad31-586c7867bb8f",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.entry[0].changes[0].field }}",
                    "rightValue": "comments"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5cf8ac8a-5158-488b-9e75-3e1fcda4a96f",
      "name": "Comment if of other user",
      "type": "n8n-nodes-base.if",
      "position": [
        380,
        900
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7ab85299-8fa9-4538-ab1f-a513e1f1fcc3",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.body.entry[0].id }}",
              "rightValue": "={{ $json.body.entry[0].changes[0].value.from.id }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "63188fa2-cdbe-4434-8950-0397651f3681",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        -160
      ],
      "parameters": {
        "color": 4,
        "width": 2600,
        "height": 2020,
        "content": "## 🎯 Overview\nThis n8n workflow template automates the process of monitoring Instagram comments and sending predefined responses based on specific comment keywords. It integrates Instagram's Graph API with Google Sheets to manage comment responses and maintains an interaction log for customer relationship management (CRM) purposes.\n\n## 🔧 Workflow Components\nThe workflow consists of **9 main nodes** organized into two primary sections:\n\n### 📡 Section 1: Webhook Verification\n- ✅ **Get Verification** (Webhook node)\n- 🔄 **Respond to Verification Message** (Respond to Webhook node)\n\n### 🤖 Section 2: Auto Comment Response\n- 📬 **Insta Update** (Webhook node)\n- ❓ **Check if update is of comment?** (Switch node)\n- 👤 **Comment if of other user** (If node)\n- 📊 **Comment List** (Google Sheets node)\n- 💬 **Send Message for Comment** (HTTP Request node)\n- 📝 **Add Interaction in Sheet (CRM)** (Google Sheets node)\n\n## 🛠️ Prerequisites and Setup Requirements\n\n### 1. 🔵 Meta/Facebook Developer Setup\n\n#### 📱 Create Facebook App\n> 📋 **Action Items:**\n> - [ ] Navigate to [Facebook Developers](https://developers.facebook.com/)\n> - [ ] Click \"Create App\" and select \"Business\" type\n> - [ ] Configure the following products:\n>   - ✅ Instagram Graph API\n>   - ✅ Facebook Login for Business  \n>   - ✅ Webhooks\n\n#### 🔐 Required Permissions\n\nConfigure the following permissions in your Meta app:\n| `instagram_basic` | 📖 Read Instagram account profile info and media\n| `instagram_manage_comments` | 💬 Create, delete, and manage comments\n| `instagram_manage_messages` | 📤 Send and receive Instagram messages \n| `pages_show_list` | 📄 Access connected Facebook pages\n\n#### 🎫 Access Token Generation\n> ⚠️ **Important Setup:**+\n> - [ ] Use Facebook's Graph API Explorer\n> - [ ] Generate a User Access Token with required permissions\n> - [ ] ⚡ **Important**: Tokens expire periodically and need refreshing\n\n### 2. 🌐 Webhook Configuration\n\n#### 🔗 Setup Webhook URL\n> 📌 **Configuration Checklist:**\n> - [ ] In Meta App Dashboard, navigate to **Products → Webhooks**\n> - [ ] Subscribe to **Instagram** object\n> - [ ] Configure webhook URL: `your-n8n-domain/webhook/instagram`\n> - [ ] Set verification token (use \"test\" or create secure token)\n> - [ ] Select webhook fields:\n>   - ✅ **comments** - For comment notifications\n>   - ✅ **messages** - For DM notifications (if needed)\n\n#### ✅ Webhook Verification Process\nThe workflow handles Meta's webhook verification automatically:\n- 📡 Meta sends GET request with `hub.challenge` parameter\n- 🔄 Workflow responds with the challenge value to confirm subscription\n\n### 3. 📊 Google Sheets Setup\n\nExample - https://docs.google.com/spreadsheets/d/1ONPKJZOpQTSxbasVcCB7oBjbZcCyAm9gZ-UNPoXM21A/edit?usp=sharing \n\n#### 📋 Create Response Management Sheet\nSet up a Google Sheets document with the following structure:\n\n**📝 Sheet 1 - Comment Responses:**\n| Column | Description | Example |\n|--------|-------------|---------|\n| 💬 Comment | Trigger keywords | `\"auto\", \"info\", \"help\"` |\n| 📝 Message | Corresponding response message | `\"Thanks for your comment! We'll get back to you soon.\"` |\n\n**📈 Sheet 2 - Interaction Log:**\n| Column | Description | Purpose |\n|--------|-------------|---------|\n| ⏰ Time | Timestamp of interaction | Track when interactions occur |\n| 🆔 User Id | Instagram user ID | Identify unique users |\n| 👤 Username | Instagram username | Human-readable identification |\n| 📝 Note | Additional notes or error messages | Debugging and analytics |\n\n---\n\n## 🔧 Built By - akash@codescale.tech\n\n\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "Insta Update": [
      {
        "body": {
          "entry": [
            {
              "id": "17841475948546607",
              "time": 1753014148,
              "changes": [
                {
                  "field": "comments",
                  "value": {
                    "id": "18017840360549208",
                    "from": {
                      "id": "711657468441200",
                      "username": "akashkankariya25"
                    },
                    "text": "auto",
                    "media": {
                      "id": "18068356241122012",
                      "media_product_type": "FEED"
                    }
                  }
                }
              ]
            }
          ],
          "object": "instagram"
        },
        "query": {},
        "params": {},
        "headers": {
          "host": "127.0.0.1:8443",
          "accept": "*/*",
          "connection": "upgrade",
          "user-agent": "Webhooks/1.0 (https://fb.me/webhooks)",
          "content-type": "application/json",
          "content-length": "308",
          "x-hub-signature": "sha1=6982132362cedd6e84a1da29d13ed2e80a559671",
          "x-hub-signature-256": "sha256=e51ccecc586e1e26646d04214cc68c5f9113da8afb9d06a98514b95ea7c502dc"
        },
        "webhookUrl": "https://n8n.algowiz.in:8443/webhook/instagram",
        "executionMode": "production"
      }
    ],
    "Get Verification": [
      {
        "body": {},
        "query": {
          "hub.mode": "subscribe",
          "hub.challenge": "1283172776",
          "hub.verify_token": "test"
        },
        "params": {},
        "headers": {
          "host": "127.0.0.1:8443",
          "accept": "*/*",
          "connection": "upgrade",
          "user-agent": "facebookplatform/1.0 (+http://developers.facebook.com)",
          "accept-encoding": "deflate, gzip"
        },
        "webhookUrl": "https://n8n.algowiz.in:8443/webhook/instagram",
        "executionMode": "production"
      }
    ]
  },
  "connections": {
    "800da6b1-b7e4-4939-8d3c-5af3a55fffca": {
      "main": [
        [
          {
            "node": "ac3030e7-adda-4432-9846-fc214bfdda4a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b6b07e6a-5605-4991-bc5d-bd108ee503e5": {
      "main": [
        [
          {
            "node": "96d3b6a2-7c39-4df1-8320-c9112c9ce91b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c7877403-33f3-4e3c-a490-6a4e6844ecf9": {
      "main": [
        [
          {
            "node": "5cddd607-4639-48eb-922a-a743736de52b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5cf8ac8a-5158-488b-9e75-3e1fcda4a96f": {
      "main": [
        [
          {
            "node": "800da6b1-b7e4-4939-8d3c-5af3a55fffca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ac3030e7-adda-4432-9846-fc214bfdda4a": {
      "main": [
        [
          {
            "node": "c87053c2-8508-4199-9c87-49d19b3b9cb1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "96d3b6a2-7c39-4df1-8320-c9112c9ce91b": {
      "main": [
        [
          {
            "node": "5cf8ac8a-5158-488b-9e75-3e1fcda4a96f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Redes sociales

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos11
Categoría1
Tipos de nodos7
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Akash Kankariya

Akash Kankariya

@akash25

I'm a developer with 5 years of experience in Python and Node.js. Over the past year, I've been building workflows to streamline operations for my team. I have also developed RAG chatbots, AI agents, and WhatsApp automation. If you need any help with N8N workflows, let's connect over a call and solve it together!

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34