GoogleシートとCRMを使用したInstagramコメント返信の自動化追跡

中級

これはSocial Media分野の自動化ワークフローで、11個のノードを含みます。主にIf, Switch, Webhook, HttpRequest, GoogleSheetsなどのノードを使用。 Instagramのコメント返信の自動化にはGoogleスプレッドシートとCRMを使用

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "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": "付箋",
      "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": "付箋1",
      "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": "付箋2",
      "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - ソーシャルメディア

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数11
カテゴリー1
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
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!

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34