AutomationFlowsSocial Media › Automated Instagram Comment Response with Dms & Google Sheets Tracking

Automated Instagram Comment Response with Dms & Google Sheets Tracking

ByJuan Carlos Cavero Gracia @carlosgracia on n8n.io

This automation template is designed for Instagram marketers, influencers, and businesses looking to supercharge their Instagram engagement strategy. It automatically monitors Instagram post comments and sends personalized direct messages (DMs) to new commenters, while…

Event trigger★★★★☆ complexity12 nodesGoogle SheetsHTTP Request
Social Media Trigger: Event Nodes: 12 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #5941 — we link there as the canonical source.

This workflow follows the Google Sheets → HTTP Request 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
{
  "id": "igcrMcr9XPqqxnqk",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Reply to Instagram Comments with DMs",
  "tags": [],
  "nodes": [
    {
      "id": "82aaa8f5-c2fc-49b4-9d69-2b439001c7dd",
      "name": "Start Monitoring",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1520,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c191f69e-4483-409a-b313-2e11e0250e47",
      "name": "Configure Post & Message",
      "type": "n8n-nodes-base.set",
      "position": [
        -1300,
        220
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "postUrl",
              "name": "postUrl",
              "type": "string",
              "value": "Instagram url post/reel"
            },
            {
              "id": "replyMessage",
              "name": "replyMessage",
              "type": "string",
              "value": "Thanks so much!  This is the template: xxxxx"
            },
            {
              "id": "profileUsername",
              "name": "profileUsername",
              "type": "string",
              "value": "add_upload_post_username"
            }
          ]
        }
      },
      "typeVersion": 3.3
    },
    {
      "id": "66a72bd2-4f15-4c01-bbad-27d0ec3ce775",
      "name": "Read Contacted Users",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1100,
        220
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298/edit?usp=drivesdk",
          "cachedResultName": "respuestas a post de instagram"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4,
      "alwaysOutputData": true
    },
    {
      "id": "78881d28-aa34-408d-a6ed-d3578f92c394",
      "name": "Filter New Comments",
      "type": "n8n-nodes-base.code",
      "position": [
        -700,
        220
      ],
      "parameters": {
        "jsCode": "const comments = $input.first().json.comments || [];\n// CR\u00cdTICO: Usar .all() para obtener TODAS las filas, no solo la primera\nconst allContactedUsersData = $('Read Contacted Users').all();\nconsole.log('\ud83d\udd0d DEBUG - Raw all contacted users:', JSON.stringify(allContactedUsersData, null, 2));\nconsole.log('\ud83d\udd0d DEBUG - Number of items from Read Contacted Users:', allContactedUsersData.length);\n\n// Extraer todos los objetos JSON de todas las ejecuciones y aplanar en un solo array\nlet contactedUsersData = [];\nallContactedUsersData.forEach((item, index) => {\n  console.log(`\ud83d\udd0d DEBUG - Processing item ${index}:`, JSON.stringify(item.json, null, 2));\n  if (item.json) {\n    if (Array.isArray(item.json)) {\n      // Si es un array, agregar todos los elementos\n      contactedUsersData.push(...item.json);\n      console.log(`\ud83d\udd0d DEBUG - Added ${item.json.length} items from array`);\n    } else {\n      // Si es un solo objeto, agregarlo\n      contactedUsersData.push(item.json);\n      console.log(`\ud83d\udd0d DEBUG - Added 1 object`);\n    }\n  }\n});\n\nconsole.log('\ud83d\udd0d DEBUG - Total extracted contacted users:', contactedUsersData.length);\n\n// DEBUGGING DETALLADO\nconsole.log('\ud83d\udd0d DEBUG - Input comments found:', comments.length);\nconsole.log('\ud83d\udd0d DEBUG - Raw contacted users data:', JSON.stringify(contactedUsersData, null, 2));\nconsole.log('\ud83d\udd0d DEBUG - Contacted users data type:', typeof contactedUsersData);\nconsole.log('\ud83d\udd0d DEBUG - Contacted users data keys:', Object.keys(contactedUsersData));\n\n// Handle different Google Sheets response formats\nlet contactedUsers = [];\n\n// IMPORTANTE: Primero verificar si es un array directo (m\u00faltiples filas)\nif (Array.isArray(contactedUsersData)) {\n  contactedUsers = contactedUsersData;\n  console.log('\ud83d\udd0d DEBUG - Using direct array format (multiple rows)');\n} \n// M\u00e9todo 2: Respuesta con .values (formato com\u00fan)\nelse if (contactedUsersData.values && Array.isArray(contactedUsersData.values)) {\n  contactedUsers = contactedUsersData.values;\n  console.log('\ud83d\udd0d DEBUG - Using .values format');\n} \n// M\u00e9todo 3: Respuesta con .data\nelse if (contactedUsersData.data && Array.isArray(contactedUsersData.data)) {\n  contactedUsers = contactedUsersData.data;\n  console.log('\ud83d\udd0d DEBUG - Using .data format');\n}\n// M\u00c9TODO 4 CORREGIDO: Manejar objetos \u00fanicos vs m\u00faltiples\nelse if (typeof contactedUsersData === 'object' && contactedUsersData !== null) {\n  // CR\u00cdTICO: Verificar si es UN SOLO objeto con comment_id (1 fila)\n  if (contactedUsersData.comment_id || contactedUsersData.username) {\n    contactedUsers = [contactedUsersData];\n    console.log('\ud83d\udd0d DEBUG - Converting single object to array (1 row)');\n  } \n  // Si es un objeto pero SIN comment_id directo, puede ser m\u00faltiples objetos\n  else {\n    // Convertir a array pero tambi\u00e9n verificar si los valores son objetos\n    const values = Object.values(contactedUsersData);\n    \n    // Si los valores son objetos con comment_id, son m\u00faltiples filas\n    if (values.length > 0 && typeof values[0] === 'object' && values[0]?.comment_id) {\n      contactedUsers = values;\n      console.log('\ud83d\udd0d DEBUG - Converting object values to array (multiple rows from object)');\n    } else {\n      contactedUsers = values;\n      console.log('\ud83d\udd0d DEBUG - Converting object values to array (unknown format)');\n    }\n  }\n}\n\n// DEBUGGING EXTRA: Mostrar qu\u00e9 tipo de datos recibimos\nconsole.log('\ud83d\udd0d DEBUG - Raw data analysis:');\nconsole.log('  - Is Array:', Array.isArray(contactedUsersData));\nconsole.log('  - Type:', typeof contactedUsersData);\nconsole.log('  - Has comment_id:', !!contactedUsersData?.comment_id);\nconsole.log('  - Object keys:', contactedUsersData ? Object.keys(contactedUsersData) : 'null');\n\nconsole.log('\ud83d\udd0d DEBUG - Final contacted users array length:', contactedUsers.length);\nconsole.log('\ud83d\udd0d DEBUG - Final contacted users array:', JSON.stringify(contactedUsers, null, 2));\n\n// Print first few rows to see the structure\nif (contactedUsers.length > 0) {\n  console.log('\ud83d\udd0d DEBUG - First 5 rows structure:');\n  contactedUsers.slice(0, 5).forEach((row, index) => {\n    console.log(`  Row ${index}:`, JSON.stringify(row, null, 2));\n    console.log(`  Row ${index} type:`, typeof row);\n    console.log(`  Row ${index} keys:`, Object.keys(row || {}));\n  });\n}\n\n// FUNCI\u00d3N PARA NORMALIZAR COMMENT IDs (cr\u00edtico para n\u00fameros largos)\nfunction normalizeCommentId(id) {\n  if (!id || id === null || id === undefined) return null;\n  \n  // Convertir a string y limpiar espacios\n  let cleanId = String(id).trim();\n  \n  // Si es vac\u00edo o es un header, retornar null\n  if (cleanId === '' || cleanId === 'comment_id') return null;\n  \n  // IMPORTANTE: Manejar n\u00fameros largos como strings para evitar problemas de precisi\u00f3n\n  // Los comment IDs de Instagram son n\u00fameros muy largos que pueden perder precisi\u00f3n\n  return cleanId;\n}\n\n// Create a set of already contacted comment IDs\nconst contactedCommentIds = new Set();\n\ncontactedUsers.forEach((row, index) => {\n  let commentId = null;\n  \n  console.log(`\ud83d\udd0d DEBUG - Processing row ${index}:`, JSON.stringify(row, null, 2));\n  \n  // Skip header row if it exists\n  if (typeof row === 'object' && row !== null && !Array.isArray(row)) {\n    // Skip if this looks like a header row\n    if (row.comment_id === 'comment_id' || row.username === 'username') {\n      console.log(`\u26a0\ufe0f Skipping header row ${index}`);\n      return;\n    }\n    \n    // Handle object format (when Google Sheets returns objects)\n    commentId = row.comment_id || row.commentId || row['comment_id'] || row['commentId'];\n    console.log(`\ud83d\udd0d DEBUG - Object format, raw comment_id: '${commentId}' (type: ${typeof commentId})`);\n  } \n  // Handle array format (when Google Sheets returns arrays)\n  else if (Array.isArray(row)) {\n    // Skip if this looks like a header row\n    if (row[0] === 'comment_id' || row[1] === 'username') {\n      console.log(`\u26a0\ufe0f Skipping header array row ${index}`);\n      return;\n    }\n    \n    // comment_id is in Column A (index 0)\n    commentId = row[0];\n    console.log(`\ud83d\udd0d DEBUG - Array format, raw comment_id: '${commentId}' (type: ${typeof commentId})`);\n  }\n  \n  // Normalize and validate comment ID\n  const normalizedId = normalizeCommentId(commentId);\n  if (normalizedId) {\n    contactedCommentIds.add(normalizedId);\n    console.log(`\u2705 Added contacted comment ID: '${normalizedId}' (length: ${normalizedId.length})`);\n  } else {\n    console.log(`\u26a0\ufe0f Row ${index} has no valid comment_id:`, commentId);\n  }\n});\n\nconsole.log('\ud83d\udd0d DEBUG - Total contacted comment IDs found:', contactedCommentIds.size);\nconsole.log('\ud83d\udd0d DEBUG - Contacted comment IDs list:', Array.from(contactedCommentIds));\n\n// Filter new comments - exclude already contacted ones\nconst newComments = comments.filter(comment => {\n  const rawCommentId = comment.id;\n  const normalizedCommentId = normalizeCommentId(rawCommentId);\n  \n  if (!normalizedCommentId) {\n    console.log(`\u26a0\ufe0f Invalid comment ID found: ${rawCommentId}`);\n    return false;\n  }\n  \n  const isAlreadyContacted = contactedCommentIds.has(normalizedCommentId);\n  \n  console.log(`\ud83d\udd0d DEBUG - Checking comment ID: '${normalizedCommentId}' (raw: ${rawCommentId}, type: ${typeof rawCommentId}), Already contacted: ${isAlreadyContacted}`);\n  \n  // Debug: Show all contacted IDs for comparison\n  if (isAlreadyContacted) {\n    console.log(`\ud83d\udd0d DEBUG - Comment ID '${normalizedCommentId}' found in contacted list`);\n  } else {\n    console.log(`\ud83d\udd0d DEBUG - Comment ID '${normalizedCommentId}' NOT found in contacted list`);\n    console.log(`\ud83d\udd0d DEBUG - All contacted IDs: [${Array.from(contactedCommentIds).join(', ')}]`);\n  }\n  \n  return !isAlreadyContacted;\n});\n\nconsole.log('\ud83d\udd0d DEBUG - New comments after filter:', newComments.length);\n\n// Log the filtering results with emojis\nconsole.log(`\ud83d\udcca Total comments retrieved: ${comments.length}`);\nconsole.log(`\u2705 Already contacted comments: ${contactedCommentIds.size}`);\nconsole.log(`\ud83c\udd95 New comments to process: ${newComments.length}`);\n\n// Log details of new comments\nnewComments.forEach((comment, index) => {\n  console.log(`\ud83c\udd95 New comment ${index + 1}: ID='${comment.id}', User='${comment.user?.username || 'unknown'}', Text='${comment.text?.substring(0, 50) || 'no text'}...'`);\n});\n\nif (newComments.length === 0) {\n  console.log('\ud83d\ude34 No new comments found. Waiting for next check...');\n  console.log('\ud83d\udd04 Workflow will continue monitoring in 15 minutes...');\n  \n  // Return a special object to indicate no processing needed\n  return [{\n    json: {\n      noNewComments: true,\n      summary: `\ud83d\udcca Monitoring complete - Found ${comments.length} total comments, ${contactedCommentIds.size} already contacted, 0 new comments to process`,\n      timestamp: new Date().toISOString(),\n      status: 'no_new_comments'\n    }\n  }];\n}\n\n// Transform each new comment into a separate item for processing\nreturn newComments.map(comment => ({\n  json: {\n    commentId: normalizeCommentId(comment.id),\n    commentText: comment.text,\n    userId: comment.user?.id || 'unknown',\n    username: comment.user?.username || 'unknown',\n    timestamp: comment.timestamp || new Date().toISOString(),\n    replyMessage: $('Configure Post & Message').first().json.replyMessage,\n    postUrl: $('Configure Post & Message').first().json.postUrl,\n    profileUsername: $('Configure Post & Message').first().json.profileUsername\n  }\n}));"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "13ad0cdd-7da6-4e57-98e8-28dae0916ed4",
      "name": "Check If Has New Comments",
      "type": "n8n-nodes-base.if",
      "position": [
        -540,
        220
      ],
      "parameters": {
        "options": {
          "ignoreCase": true,
          "looseTypeValidation": true
        },
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "has_new_comments",
              "operator": {
                "type": "boolean",
                "operation": "notEqual"
              },
              "leftValue": "={{ $json.noNewComments }}",
              "rightValue": true
            },
            {
              "id": "f38ffd12-c4b2-4971-944c-b983ff3541fa",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ !$json.noNewComments }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f20e9a90-f8db-4f42-acdb-1e99295a0a0c",
      "name": "Send Reply to Comment",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -340,
        120
      ],
      "parameters": {
        "url": "https://api.upload-post.com/api/uploadposts/comments/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"platform\": \"instagram\",\n  \"user\": \"{{ $json.profileUsername }}\",\n  \"comment_id\": \"{{ $json.commentId }}\",\n  \"message\": \"{{ $json.replyMessage }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "7e4c9bd5-973f-4a15-941d-239ae9581bd8",
      "name": "Check Reply Success",
      "type": "n8n-nodes-base.if",
      "position": [
        -180,
        20
      ],
      "parameters": {
        "options": {
          "ignoreCase": true,
          "looseTypeValidation": true
        },
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "success_check",
              "operator": {
                "type": "boolean",
                "operation": "equal"
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": true
            },
            {
              "id": "15c2064a-8fbd-446e-8d36-29852df64def",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": "=true"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "40146447-62b1-4c97-87f6-44db758b4c8d",
      "name": "Record Contacted User",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        40,
        -60
      ],
      "parameters": {
        "columns": {
          "value": {
            "post_url": "={{ $('Filter New Comments').item.json.postUrl }}",
            "username": "={{ $('Filter New Comments').item.json.username }}",
            "timestamp": "={{ $('Filter New Comments').item.json.timestamp }}",
            "comment_id": "={{ $('Filter New Comments').item.json.commentId }}",
            "message_sent": "={{ $('Filter New Comments').item.json.replyMessage }}"
          },
          "schema": [
            {
              "id": "comment_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "comment_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "message_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "post_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "post_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SNZYngGfvIxZJ6VAiwD9Keuj6DugbijLH59vyK4L298/edit?usp=drivesdk",
          "cachedResultName": "respuestas a post de instagram"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "730bb698-62e4-4944-83c3-982864140daf",
      "name": "Log Failed Reply",
      "type": "n8n-nodes-base.code",
      "position": [
        40,
        100
      ],
      "parameters": {
        "jsCode": "// Log failed replies for debugging\nconst failedReply = {\n  userId: $('Filter New Comments').item.json.userId,\n  username: $('Filter New Comments').item.json.username,\n  commentId: $('Filter New Comments').item.json.commentId,\n  error: $json.error || 'Unknown error',\n  timestamp: new Date().toISOString()\n};\n\nconsole.log('\u274c Failed to send reply:', failedReply);\n\nreturn [{ json: failedReply }];"
      },
      "typeVersion": 2
    },
    {
      "id": "c87fe62f-9024-4827-8c56-65075e00fb23",
      "name": "Generate Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        260,
        240
      ],
      "parameters": {
        "jsCode": "// Summary of the monitoring session with proper error handling\nlet totalComments = 0;\nlet newComments = 0;\nlet successfulReplies = 0;\nlet failedReplies = 0;\nlet monitoredPostUrl = '';\n\ntry {\n  // Get total comments (handle if node wasn't executed)\n  const getPostCommentsData = $('Get Post Comments').first();\n  totalComments = getPostCommentsData?.json?.comments?.length || 0;\n} catch (error) {\n  console.log('\u26a0\ufe0f Could not get total comments data:', error.message);\n  totalComments = 0;\n}\n\ntry {\n  // Get new comments (handle if node wasn't executed)\n  const filterNewCommentsData = $('Filter New Comments').all();\n  newComments = filterNewCommentsData?.length || 0;\n} catch (error) {\n  console.log('\u26a0\ufe0f Could not get new comments data:', error.message);\n  newComments = 0;\n}\n\ntry {\n  // Get successful replies (handle if node wasn't executed)\n  const recordContactedData = $('Record Contacted User').all();\n  successfulReplies = recordContactedData?.length || 0;\n} catch (error) {\n  console.log('\u26a0\ufe0f Could not get successful replies data:', error.message);\n  successfulReplies = 0;\n}\n\ntry {\n  // Get failed replies (handle if node wasn't executed)\n  const logFailedData = $('Log Failed Reply').all();\n  failedReplies = logFailedData?.length || 0;\n} catch (error) {\n  console.log('\u26a0\ufe0f Could not get failed replies data:', error.message);\n  failedReplies = 0;\n}\n\ntry {\n  // Get monitored post URL\n  const configData = $('Configure Post & Message').first();\n  monitoredPostUrl = configData?.json?.postUrl || 'Unknown URL';\n} catch (error) {\n  console.log('\u26a0\ufe0f Could not get post URL:', error.message);\n  monitoredPostUrl = 'Unknown URL';\n}\n\nconst summary = {\n  totalComments,\n  newComments,\n  successfulReplies,\n  failedReplies,\n  monitoredPostUrl,\n  timestamp: new Date().toISOString(),\n  status: 'completed'\n};\n\nconsole.log('\ud83d\udcc8 Monitoring Summary:', JSON.stringify(summary, null, 2));\n\n// Generate appropriate emoji and message\nconst emoji = successfulReplies > 0 ? '\ud83c\udf89' : failedReplies > 0 ? '\u26a0\ufe0f' : totalComments > 0 ? '\ud83d\udc40' : '\ud83d\ude34';\nlet message = `${emoji} Monitoring cycle complete!`;\n\nif (totalComments > 0) {\n  message += ` Found ${totalComments} total comments`;\n  \n  if (newComments > 0) {\n    message += `, ${newComments} new comments`;\n    \n    if (successfulReplies > 0) {\n      message += `, sent ${successfulReplies} replies successfully`;\n    }\n    \n    if (failedReplies > 0) {\n      message += `, ${failedReplies} failed`;\n    }\n  } else {\n    message += ', no new comments to process';\n  }\n} else {\n  message += ' No comments found or error retrieving comments';\n}\n\nconsole.log(message);\nconsole.log('\u23f0 Next check in 15 minutes...');\nconsole.log('\ud83d\udd04 Workflow will continue monitoring...');\n\nreturn [{\n  json: {\n    summary,\n    message,\n    continueMonitoring: true\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1ae9c8df-41b4-42e5-9df9-691fb9b6f2ad",
      "name": "Get Post Comments",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -920,
        220
      ],
      "parameters": {
        "url": "=https://api.upload-post.com/api/uploadposts/comments",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "platform",
              "value": "instagram"
            },
            {
              "name": "user",
              "value": "={{ $('Configure Post & Message').item.json.profileUsername }}"
            },
            {
              "name": "post_url",
              "value": "={{ $('Configure Post & Message').item.json.postUrl }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "08822705-3afd-4ea4-8d9e-8874d989507c",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1520,
        340
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d68f95d6-0596-4d0e-8aa7-498bab2097bc",
  "connections": {
    "Log Failed Reply": {
      "main": [
        [
          {
            "node": "Generate Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Configure Post & Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Monitoring": {
      "main": [
        [
          {
            "node": "Configure Post & Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Post Comments": {
      "main": [
        [
          {
            "node": "Filter New Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Reply Success": {
      "main": [
        [
          {
            "node": "Record Contacted User",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Failed Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter New Comments": {
      "main": [
        [
          {
            "node": "Check If Has New Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Contacted Users": {
      "main": [
        [
          {
            "node": "Get Post Comments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record Contacted User": {
      "main": [
        [
          {
            "node": "Generate Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Reply to Comment": {
      "main": [
        [
          {
            "node": "Check Reply Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configure Post & Message": {
      "main": [
        [
          {
            "node": "Read Contacted Users",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Has New Comments": {
      "main": [
        [
          {
            "node": "Send Reply to Comment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

This automation template is designed for Instagram marketers, influencers, and businesses looking to supercharge their Instagram engagement strategy. It automatically monitors Instagram post comments and sends personalized direct messages (DMs) to new commenters, while…

Source: https://n8n.io/workflows/5941/ — original creator credit. Request a take-down →

More Social Media workflows → · Browse all categories →

Related workflows

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

Social Media

🚀 Discover trending and viral YouTube videos easily with this powerful n8n automation! This workflow helps you perform bulk research on YouTube videos related to any search term, analyzing engagement

HTTP Request, Google Sheets, Form Trigger
Social Media

Use cases are many: Whether you're a YouTube creator trying to understand your audience, a marketer running sample analysis, a data analyst compiling engagement metrics, or part of a growth team track

Google Sheets, HTTP Request
Social Media

This cutting-edge n8n workflow is a powerful automation tool designed to revolutionize how businesses and marketers identify and qualify leads directly from YouTube video comments. By leveraging speci

HTTP Request, Google Sheets, Chat Trigger +5
Social Media

Automatically detects and hides hate speech/toxic comments, alerts your team, and logs flagged content for review. Trigger: A Schedule node runs every 15 minutes to poll for new comments (Instagram do

HTTP Request, Slack, Google Sheets
Social Media

This workflow fetches the most popular YouTube videos in Germany and transforms them into a clean list of trending hashtags/keywords. It’s not just raw data – it highlights qualitative insights about

HTTP Request, Item Lists