n8nflow.net logo

Automate Instagram Comment Responses with Google Sheets & CRM Tracking

by Akash Kankariya•Updated: Last update 2 months ago•Source: n8n.io
Loading workflow viewer...

Getting Started

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

šŸŽÆ Overview

This 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.

šŸ”§ Workflow Components

The workflow consists of 9 main nodes organized into two primary sections:

šŸ“” Section 1: Webhook Verification

  • āœ… Get Verification (Webhook node)
  • šŸ”„ Respond to Verification Message (Respond to Webhook node)

šŸ¤– Section 2: Auto Comment Response

  • šŸ“¬ Insta Update (Webhook node)
  • ā“ Check if update is of comment? (Switch node)
  • šŸ‘¤ Comment if of other user (If node)
  • šŸ“Š Comment List (Google Sheets node)
  • šŸ’¬ Send Message for Comment (HTTP Request node)
  • šŸ“ Add Interaction in Sheet (CRM) (Google Sheets node)

šŸ› ļø Prerequisites and Setup Requirements

1. šŸ”µ Meta/Facebook Developer Setup

šŸ“± Create Facebook App

šŸ“‹ Action Items:

  • Navigate to Facebook Developers
  • Click "Create App" and select "Business" type
  • Configure the following products:
    • āœ… Instagram Graph API
    • āœ… Facebook Login for Business
    • āœ… Webhooks

šŸ” Required Permissions

Configure the following permissions in your Meta app:
| instagram_basic | šŸ“– Read Instagram account profile info and media
| instagram_manage_comments | šŸ’¬ Create, delete, and manage comments
| instagram_manage_messages | šŸ“¤ Send and receive Instagram messages
| pages_show_list | šŸ“„ Access connected Facebook pages

šŸŽ« Access Token Generation

āš ļø Important Setup: +

  • Use Facebook's Graph API Explorer
  • Generate a User Access Token with required permissions
  • ⚔ Important : Tokens expire periodically and need refreshing

2. 🌐 Webhook Configuration

šŸ”— Setup Webhook URL

šŸ“Œ Configuration Checklist:

  • In Meta App Dashboard, navigate to Products → Webhooks
  • Subscribe to Instagram object
  • Configure webhook URL: your-n8n-domain/webhook/instagram
  • Set verification token (use "test" or create secure token)
  • Select webhook fields:
    • āœ… comments - For comment notifications
    • āœ… messages - For DM notifications (if needed)

āœ… Webhook Verification Process

The workflow handles Meta's webhook verification automatically:

  • šŸ“” Meta sends GET request with hub.challenge parameter
  • šŸ”„ Workflow responds with the challenge value to confirm subscription

3. šŸ“Š Google Sheets Setup

Example - https://docs.google.com/spreadsheets/d/1ONPKJZOpQTSxbasVcCB7oBjbZcCyAm9gZ-UNPoXM21A/edit?usp=sharing

šŸ“‹ Create Response Management Sheet

Set up a Google Sheets document with the following structure:

šŸ“ Sheet 1 - Comment Responses:

ColumnDescriptionExample
šŸ’¬ CommentTrigger keywords"auto", "info", "help"
šŸ“ MessageCorresponding response message"Thanks for your comment! We'll get back to you soon."

šŸ“ˆ Sheet 2 - Interaction Log:

ColumnDescriptionPurpose
ā° TimeTimestamp of interactionTrack when interactions occur
šŸ†” User IdInstagram user IDIdentify unique users
šŸ‘¤ UsernameInstagram usernameHuman-readable identification
šŸ“ NoteAdditional notes or error messagesDebugging and analytics

šŸ”§ Built By - [email protected]