← Back to directory
Marketing Medium to set up AI workflow Enrich

Facebook Comment Sentiment Analysis

Source reviewed Updated 2026-07-07

Fetches comments from a Facebook post, analyzes sentiment with Gemini, and updates a Google Sheet without duplicates.

What it does

You automatically gather comments from your Facebook posts, analyze their sentiment using AI, and save the results to a Google Sheet without duplicates. This workflow handles pagination seamlessly so you can run it manually for testing or trigger it as part of your automation pipeline.

Step by step

  1. Configure the Facebook Graph API node to fetch comments from a specific post ID using pagination parameters.
  2. Set up the Google Sheets node with a script or built-in action that checks for existing comment IDs before appending new rows.
  3. Define the input schema for the Gemini model to accept raw comment text and return structured JSON sentiment scores.

Where the LLM does the work

  • Craft the system prompt for Google Gemini to ensure consistent sentiment classification across varying comment tones and slang.
  • Design the output parsing logic to handle edge cases where the AI returns non-JSON responses or ambiguous confidence levels.
  • Refine the data cleaning steps in the workflow to normalize text before sending it to the model for better accuracy.

Watch out for

Sentiment models often misinterpret sarcasm or context-heavy comments, so add a low-confidence flag column for manual review later.

Tools that fit

Facebook Graph API API Fetching post comments
Google Gemini Chat Model LLM Sentiment classification
Google Sheets Service Storing analysis results

The agent brief

Everything your agent needs, including the gotchas. Copy it and go.
agent-brief.md
You are helping me build the following AI agent workflow.

## Goal
Facebook Comment Sentiment Analysis: Fetches comments from a Facebook post, analyzes sentiment with Gemini, and updates a Google Sheet without duplicates.

## Specification
- What it does: You automatically gather comments from your Facebook posts, analyze their sentiment using AI, and save the results to a Google Sheet without duplicates. This workflow handles pagination seamlessly so you can run it manually for testing or trigger it as part of your automation pipeline.
- Trigger: Run manually (Manual · on demand or Scheduled)
- Autonomy: Fully hands-off
- Expected setup effort: about an afternoon
- Tools/services involved:
  - Facebook Graph API: Fetching post comments
  - Google Gemini Chat Model: Sentiment classification
  - Google Sheets: Storing analysis results

## Known pitfalls, handle each one explicitly in your implementation
1. Sentiment models often misinterpret sarcasm or context-heavy comments, so add a low-confidence flag column for manual review later.

## Reference implementation
https://n8n.io/workflows/13234 (workflow template)
Fetch and inspect this before building. If it matches my stack, adapt it;
if not, rebuild the pattern with my tools.

## Process requirements
1. Before building: ask me which of the listed tools I actually use and
   what my platform is (n8n / Make / code / other). Do not assume.
2. Adapt the pattern to my answers; do not force the reference stack.
3. Address every pitfall above; tell me how you handled each.
4. Provide a test plan I can run before letting this touch real data.
5. Ask before any step that sends messages, modifies data, or spends money.

Source: https://usecasesforagents.com/use-case/facebook-comment-sentiment-analysis/ via usecasesforagents.com

Frequently asked questions

Can I use a different Social Media than Facebook Graph API?

Yes. Facebook Graph API is only the example social media in this recipe. The same flow works with Blotato, Google Business Profile, Instagram Graph API and LinkedIn. Swap the social media connection and keep the rest of the setup as written.

Want this running in your business?

This is what I do. I design and build AI agents like this one, and keep them running. If you want it set up for your team instead of doing it yourself, get in touch.
Get in touch →

Who it's for

Built for marketers who'd rather brief an agent than start from a blank doc.

Seen in the wild

← Back to directory