π 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.
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
- Runs manually to load configuration values and fetch the target Facebook post details.
- Pulls comments from the Facebook Graph API in reverse-chronological order and paginates through comment pages up to the configured maximum.
- For each fetched comment page, re-invokes the workflow to batch-process the comments passed in as input.
- 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.
- Appends or updates each comment (post ID, comment ID, text, sentiment) in Google Sheets using the comment ID as the deduplication key.
- 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
- Add Facebook Graph API credentials and ensure your access token has permission to read the Page post and its comments.
- Add an OpenAI API credential and set the model name you want to use in the configuration.
- Add a Google Sheets OAuth connection, create/select a spreadsheet tab, and ensure it has columns POST ID, COMMENT ID, COMMENT, and SENTIMENT.
- Add a Gmail OAuth connection and set the recipient email address for the summary report in the configuration.
- 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.
π 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
