πŸ“Š Analyze Facebook post comment sentiment with OpenAI, Google Sheets, and Gmail

⚑ 122 views Β· πŸ“Š Market Research & Insights

πŸ’‘ Pro Tip β€” If you’ve run into Facebook’s Graph API permission restrictions, ScraperNode is a community node that scrapes pages, groups, posts, and comments directly β€” no app review needed.

View All Scrapers

Description

Quick overview

This workflow fetches comments from a Facebook Page post via the Facebook Graph API, classifies each comment’s sentiment with OpenAI, stores results in Google Sheets, and emails a sentiment breakdown summary via Gmail.

How it works

  1. Runs manually to load configuration values and fetch the target Facebook post details.
  2. Pulls comments from the Facebook Graph API in reverse-chronological order and paginates through comment pages up to the configured maximum.
  3. For each fetched comment page, re-invokes the workflow to batch-process the comments passed in as input.
  4. Splits the page into individual comments, sends each comment to OpenAI to classify sentiment into the configured categories, and throttles requests with a short wait.
  5. Appends or updates each comment (post ID, comment ID, text, sentiment) in Google Sheets using the comment ID as the deduplication key.
  6. Reads all stored rows for the post from Google Sheets, aggregates sentiment counts, and emails the summary report to the configured recipient using Gmail.

Setup

  1. Add Facebook Graph API credentials and ensure your access token has permission to read the Page post and its comments.
  2. Add an OpenAI API credential and set the model name you want to use in the configuration.
  3. Add a Google Sheets OAuth connection, create/select a spreadsheet tab, and ensure it has columns POST ID, COMMENT ID, COMMENT, and SENTIMENT.
  4. Add a Gmail OAuth connection and set the recipient email address for the summary report in the configuration.
  5. Fill in the Configuration values (Facebook post ID, spreadsheet ID, sheet name, batch size, wait seconds, and max pages) and ensure the self-invoked workflow reference points to this saved workflow.

Additional info

Analyze Facebook post comments sentiment with OpenAI

πŸ“₯ Open full documentation on Notion

Need help customizing?

Contact me for consulting and support : Linkedin

MY NEW YOUTUBE CHANNEL

πŸ‘‰ Subscribe to my new YouTube channel. Here I’ll share videos and Shorts with practical tutorials and FREE templates for n8n.

The AI Doctor

πŸ”— Nodes Used

Google Sheets, Execute Sub-workflow, Facebook Graph API, Gmail, Execute Workflow Trigger, OpenAI Chat Model

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup