Sentiment dashboard template

  • React
  • Vite
  • Chart.js

Score reviews, tickets and messages as positive, negative or neutral, with a running chart and history.

A React dashboard for the tone of what people write to you. Paste a review, support ticket or message and see whether it reads positive, negative or neutral, and how strongly. Every result is added to a chart, quick stats and a history kept in the browser. Use it to triage feedback, or score messages as they arrive.

The sentiment dashboard app running

What it does

Five shades of tone
Labels each text from very negative to very positive, with a score you can sort and filter by.
Chart and stats
A doughnut chart and counts show the mix of positive, negative and neutral at a glance.
History that stays
Results are kept in this browser, so the dashboard is still there when you come back.
Keeps your key private
The page calls a Vercel function in api/, which holds the key, checks the input and limits each visitor to 10 analyses a minute.
Runs locally in one command
npm run dev serves the page and runs the api/ functions together, the same way Vercel does, with no CLI to install.

How it works

The Vercel function: it checks the text and calls Sentiment Analysis.

api/sentiment.js
import { guard, callApi, respond, fail, str } from '../lib/apiverve.js';

/** POST /api/sentiment { text }: whether the text reads positive, negative or neutral, and how strongly. */
export async function POST(request) {
  const blocked = guard(request);
  if (blocked) return blocked;

  const body = await request.json().catch(() => ({}));
  const text = str(body.text, 2000);
  if (!text) return fail('Enter some text to analyze');

  return respond(() => callApi('sentimentanalysis', { json: { text } }));
}

See the whole file on GitHub

Deploy it

  1. Get a free API key

    The free plan includes 200 credits a month, no card needed. Create your key.

  2. Deploy it

    Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for APIVERVE_API_KEY: paste your key there.

  3. Open your app

    Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.

Try the Sentiment Analysis API — the call this template makes

Request
POSTapi.apiverve.com/v1/sentimentanalysis
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "comparative": 0.25,
    "sentimentText": "positive",
    "sentiment": 3,
    "isPositive": true,
    "isNegative": false,
    "normalizedScore": 0.3
  }
}

Build your own with Sentiment Analysis. Start with 200 free credits. One key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs