Back to Dashboard User Guide v3.0

Social Listener

Complete guide to your Social Media Listening Tool

Part of Wosuol System · Version 3.0 · AI Powered by Google Gemini

Table of Contents

1. System Overview

Social Listener monitors your brand, name, or product across social media platforms. It automatically:

Key Components

Dashboard (index.php)Visual interface to see all mentions, charts, stats, and AI replies
API (api.php)Backend that handles data processing, AI sentiment analysis, and reply generation
Database (MySQL)Stores all mentions, replies, and monitoring targets
n8n WorkflowAutomation that scrapes social media every 30 minutes
ApifyCloud scraping service that collects data from Facebook, Instagram, Google, etc.
Google Gemini AIAI that classifies sentiment and generates professional reply suggestions (FREE)

2. How It Works

Every 30 minutes, this happens automatically:

n8n triggers → Reads your targets → Apify scrapes social media → Gemini AI analyzes sentiment → Gemini generates reply → Saved to database → Appears on dashboard

Data Flow

1
n8n Schedule Trigger fires every 30 minutes
2
n8n reads targets from your API: GET api.php?action=get_targets
3
For each target, n8n calls the appropriate Apify scraper (Google Search for keywords, Facebook scraper for pages, Instagram scraper for accounts)
4
Scraped results are normalized into a unified format (platform, author, content, URL)
5
Each mention is sent to your API: POST api.php?action=process_mention
6
Your API calls Gemini AI to classify sentiment + generate a reply suggestion, then saves everything to MySQL
7
Dashboard displays everything with real-time charts, color-coded alerts, and AI reply buttons

3. Dashboard Guide

Stat Cards (Top Row)

Total MentionsTotal number of social media mentions collected. Shows today's count below.
Risk AlertsCount of Negative + Offensive mentions. Red border and pulse animation when active. These need your attention first.
Pending ReviewMentions you haven't marked as "handled" yet. Your to-do list.
HandledMentions you've reviewed and marked as done.

Charts

Live Feed Table

Action Buttons (per row)

ViewOpens the original post on social media in a new tab
HandleMarks the mention as reviewed/handled (updates instantly)
ReplyOpens the AI Reply modal with a generated professional reply you can copy
DeletePermanently deletes this mention from the database

Toolbar Buttons

RefreshManually refresh stats (also auto-refreshes every 60 seconds)
ExportDownloads all visible mentions as a CSV file
ConfigOpen the monitoring target configuration
GuideOpens this user guide
ThemeToggle dark/light mode (saved in your browser)

Filters

Use the filter dropdowns above the feed table to narrow down results:

Clear All

The Clear All button (red, next to "Live Feed") deletes ALL mentions from the database. It requires double confirmation. Use this to reset your data and start fresh.

4. Managing Monitoring Targets

Targets tell the system what to search for. Click "Config" in the navbar to manage them.

Target Types

TypeWhat to EnterWhat It Does
keywordAny text: brand name, person name, productSearches Google for mentions on Facebook, Instagram, X, TikTok, and LinkedIn
facebook_pageFull URL: https://facebook.com/pagenameScrapes up to 50 recent posts and 100 comments from that page
instagram_accountHandle: @usernameScrapes up to 50 recent posts from that account
twitter_handleHandle: @usernameFuture: will search Twitter/X mentions directly
urlAny website URLFuture: will monitor that URL for changes

Best Practices

Scraping Limits per Target

Target TypePosts ScrapedComments ScrapedGoogle Pages
Facebook Page50 posts100 comments-
Instagram Account50 posts--
Keyword SearchUp to 150 results-3 pages x 50 results

5. AI Reply Suggestions

Powered by Google Gemini AI (FREE)
Every mention automatically gets an AI-generated professional reply suggestion. You review, edit, and copy it to post from your real social media account.

How It Works

1
When a new mention is scraped, the AI automatically generates a reply and saves it in the database
2
On the dashboard, click the yellow reply button on any mention
3
A modal opens showing the original post and the AI-suggested reply
4
Edit the reply text if needed - the textarea is fully editable
5
Click "Regenerate" to get a completely new reply from the AI
6
Click "Copy to Clipboard" then paste it on the social media platform from your real account

Reply Tone by Sentiment

SentimentAI Reply Tone
PositiveWarm thanks, appreciation, encourages connection
NeutralFriendly acknowledgment, offers help
NegativeEmpathetic, acknowledges concern, invites private resolution via DM/email
OffensiveCalm, professional, states facts, avoids conflict

Language Matching

The AI automatically replies in the same language as the original post. If someone posts in Arabic, the reply will be in Arabic. If in English, the reply will be in English.

Important Notes

6. Sentiment Analysis (Gemini AI)

Every mention is analyzed by Google Gemini AI (gemini-2.0-flash model) and classified into one of four categories:

Positive
Praise, recommendation, satisfaction, love, thanks
Negative
Complaints, criticism, dissatisfaction, problems
Neutral
Information, questions, news, no emotion
Offensive
Insults, threats, scam accusations, defamation, hate

Cost: FREE

7. n8n Workflow

The n8n workflow is the automation engine that runs every 30 minutes.

Workflow Nodes (6 nodes)

#NodeWhat It Does
1Every 30 MinutesSchedule trigger - starts the workflow automatically
2Get Active TargetsCalls your API to get the list of keywords/pages to monitor
3Prepare Apify JobsConverts each target into an Apify scraping job with the right parameters
4Run Apify ScraperCalls Apify's API to scrape Facebook/Instagram/Google for each target
5Normalize ResultsConverts different Apify output formats into a unified mention format
6AI Sentiment + SaveSends each mention to your PHP API, which calls Gemini AI for sentiment + reply, then saves to database

Apify Actors Used

Apify Free Tier

How to Update the Workflow

  1. Go to your n8n dashboard
  2. Delete the old workflow
  3. Click Import from file and upload the new n8n-workflow.json
  4. Make sure it's activated (toggle in the top right)
  5. Run it manually once to test by clicking "Execute Workflow"

8. API Reference

Base URL: https://social.wosuol.com/api.php

Public Endpoints (No Auth)

EndpointMethodDescription
?action=statsGETReturns total, risk, pending counts + sentiment/platform breakdowns
?action=get_targetsGETReturns all active monitoring targets (n8n reads this)
?action=mark_handledPOSTMark a mention as handled. Body: id=123
?action=delete_mentionPOSTDelete a single mention. Body: id=123
?action=delete_all_mentionsPOSTDelete ALL mentions and reset auto-increment
?action=generate_replyPOSTGenerate/regenerate AI reply for a mention. Body: id=123
?action=add_targetPOSTAdd monitoring target. Body: target_type=keyword&target_value=test
?action=delete_targetPOSTDelete target. Body: id=5
?action=toggle_targetPOSTToggle target active/inactive. Body: id=5

Protected Endpoints (Require X-Api-Key header)

EndpointMethodDescription
?action=process_mentionPOSTInsert 1 mention + auto AI sentiment + auto AI reply. JSON body with platform, author_name, post_content, post_url
?action=process_batchPOSTInsert multiple mentions at once. JSON array body.
?action=testGETTest API connection - shows Gemini AI, database, and curl status

Example: Insert a Mention via API

curl -X POST \
  -H "X-Api-Key: your-secret-key" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "Facebook",
    "author_name": "John Doe",
    "post_content": "This product is amazing!",
    "post_url": "https://facebook.com/post/123",
    "keyword_matched": "brand name"
  }' \
  https://social.wosuol.com/api.php?action=process_mention

Response:

{"success": true, "id": 45, "sentiment": "Positive", "has_reply": true}

Example: Test Connection

https://social.wosuol.com/api.php?action=test&api_key=your-secret-key

Response shows: Gemini status, API key status, model name, DB connection, curl availability.

9. Troubleshooting

Common Issues

"Could not generate reply" or "Sentiment is always Neutral"

"n8n workflow shows 404 error on Apify"

Make sure actor names use tilde (~) not slash: apify~google-search-scraper not apify/google-search-scraper

"Dashboard shows no data"

"Only getting ~20 results"

"Apify credits running out"

"Reply button not working"

"Duplicate mentions appearing"

The API checks post_url for duplicates. If Apify returns posts without URLs, duplicates may occur. This is normal for Google search results.

"Database connection failed"

Check config.php → DB_HOST, DB_NAME, DB_USER, DB_PASS. On Hostinger, the host is usually localhost.

Configuration File: config.php

SettingDescription
DB_HOST, DB_NAME, DB_USER, DB_PASSMySQL database credentials (from Hostinger)
GEMINI_API_KEYYour Google Gemini API key (free from aistudio.google.com)
GEMINI_MODELAI model to use. Default: gemini-2.0-flash (free, fast)
APIFY_TOKENYour Apify API token (from console.apify.com)
API_SECRET_KEYSecret key for protected API endpoints. Used in n8n X-Api-Key header.

Social Listener v3.0 · Part of Wosuol System · AI by Google Gemini

Back to Dashboard