Comments, mentions and competitors' ads
AI classifies sentiment and topic of each new text
Sentiment index, rising topics and summary
Report, crisis alert and dashboard
What it solves
- Every comment and mention gets a sentiment and a topic exactly once, at a controlled cost.
- The sentiment index separates what the AI could not classify.
- The client's leadership only gets topics that truly grew, above a minimum volume.
Business questions it answers
Ask your agent these questions once the case is live.
What you need
- The client's networks or the social listening tool connected to Nekt
- A language model API key stored in the secrets vault
- The topic list and the sentiment rule agreed with the client
What you get
- A mentions table with sentiment, topic and classification date
- Sentiment index and volume per network over 24 and 72 hours, with history
- Rising topics and an executive summary written from the numbers
- An alert when a negative topic grows above the threshold
Where to activate
Brand health section with the index, rising topics and the summary written from the numbers.
Warning when a topic with negative sentiment starts rising above the volume floor.
Occurrences by day, network and sentiment, and the index history to see the trend.
The notebook is short, but it needs care with API cost, reprocessing and silent model failures. Scraping profiles and ad libraries needs constant maintenance. The detailed view has the business rules, the pitfalls and the acceptance test. Or send everything straight to your agent with the Nekt MCP.
The source delivers free text, often only the current state, and every run brings back comments already seen. Whoever classifies everything again pays several times for the same text; whoever treats an API error as neutral delivers a report with no negatives at all; whoever lets the AI invent topics on every run cannot compare one week with another. And a 100% rise on two mentions becomes a crisis alert.
How it is usually done, and the rule
Each row is a mistake that already happened in practice.
Use the comment or mention id as the key and classify only ids not yet in the output table, writing by append. In scraped sources without a stable id, the key is client + platform + post + author + reply flag + md5 hash of the text, written by upsert. Reprocess a post only if its comment count grew.
API errors, rate limits, responses out of format or outside the list become 'unclassified', to be retried on the next run. Never use neutral as the default value. Call the model with temperature zero and JSON output, and log the first error of each run with the response status and body.
Positive: praise, thanks, support, approval. Negative: criticism, complaint, negative irony, insult, dissatisfaction. Neutral: question, informational comment, tagging another person with no opinion. Empty text does not go to the AI. The rule lives in the prompt and in the client's context, the same for every run.
Discovering topics from scratch on every run changes the names and breaks the history. Keep a closed topic list per client in the context, classify each mention into exactly one of them, and let the AI suggest new topics in a separate column for human review. If the call fails, use the default list, never an empty one.
Index = (positives x 100 + neutrals x 50) / (positives + neutrals + negatives). Unclassified mentions stay out of the denominator and appear alongside, with the classification rate. Compute it per network and in total, over the same window.
Compare the last 24 hours with the previous 24 and the last 72 with the previous 72. If both periods have fewer than 5 mentions, the trend is 'insufficient volume'. Up above +15%, down below -15%, stable in between. Highlight at most the 2 rising topics with a dominant negative sentiment, and the 2 positive ones.
The 24 and 72 hour windows count back from the source's most recent mention, and that mention's date appears in the result. If the source stopped, the dashboard shows the data is stale instead of saying the brand went quiet.
Volume, percentages, index and rising topics are computed in code. The executive summary receives those numbers ready and only writes, following the client's style rules. If the writing call fails, save a summary built directly from the numbers.
To monitor competitors, collect active ads from the Meta Ad Library (by page or search) and the Google Ads Transparency Center (by domain or advertiser), write by upsert with the key client + platform + creative id, and classify the text with one objective question per client (for example, whether the ad is about the topic the client sells).
Build the mention text from content, title, caption, description and hashtags, and truncate it to a fixed length before sending (for example, 300 characters for topic and 1,000 for sentiment). Send the model only the text and the id, without the name, profile or contact of whoever wrote it.
From text to index
Weight of each classification in the 0 to 100 sentiment index.
Definitions
Pitfalls that already happened
The weekly report showed every comment as neutral. The API call was failing and the code returned neutral as the default value.
Failures become 'unclassified' and the classification rate shows in the report.
Files from different syncs had incompatible encodings and the default read of the comments table failed in the notebook.
Read file by file, filtering by the cutoff date, when the default read fails.
The AI discovered topics from scratch on every load and the same theme appeared under different names, with no comparable series.
Closed list per client and new suggestions kept apart.
Profile scraping brought back the same comments on every run, with no stable id, and the count kept growing by itself.
Key with the text hash and writes by upsert.
The session of the account used for scraping expired without landing on the expected login screen, and the run finished as a success with no new comments.
Alert when a successful run brings nothing from a profile that always brings something.
A topic went from 1 to 2 negative mentions and appeared as a 100% rise in the summary for leadership.
A floor of 5 mentions before computing a trend.
Acceptance test
The case is done when every item passes.
- Running classification twice in a row creates no new rows and no new API calls.
- Positives + neutrals + negatives + unclassified = total mentions in the window.
- The sentiment index recomputed from the counts matches the published one, per network.
- No topic with fewer than 5 mentions in both periods shows a trend.
- More than 95% of the window's mentions are classified, or the report shows the incomplete classification warning.
Agent package
Paste into Claude, ChatGPT or any client with the Nekt MCP connected.
Brand and sentiment - Each mention or comment is classified once: sentiment (positive, neutral, negative, unclassified) and one topic from the client's list. - 'Unclassified' is an AI failure, not neutral. Report the classification rate alongside any percentage. - Sentiment index = (positives x 100 + neutrals x 50) / classified. Unclassified excluded. - Trend: last 24h against the previous 24h and 72h against the previous 72h. Fewer than 5 mentions in both periods = insufficient volume. Up above +15%, down below -15%. - Windows count back from the most recent mention. State its date. - Numbers come from the tables. Do not count mentions by reading texts. - Do not cite the author, profile or contact of whoever commented. Client exceptions: - <client>: topics <topic list>; competitors monitored <list of pages or domains>. - <client>: summary for leadership in paragraphs, no lists, ending with the risk or opportunity reading.
Build the "Brand and sentiment with AI" case in my Nekt workspace following the rules at https://academy.nekt.com/en/industrias/agencias/marca-sentimento-ia.md. 1) Find the source tables and confirm the columns the rules use. 2) Create a transformation at the stated grain applying every rule. 3) Run the acceptance test and show me the result of each item. 4) Create the case's context document in the workspace, leaving my clients' exceptions open for me to fill in.
Variations
Sentiment of the client's Instagram comments per post, to find the content that draws complaints.
Light sweep of the posts from recent months, selection of those with the most comments and classification of only those, flagging spam and relevant insights.
The same model applied to Google Business Profile reviews, filtered by the client's location.