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