DEV Community

Daniel Igel
Daniel Igel

Posted on

Build a customer feedback sentiment dashboard in Node.js — no ML setup, just a REST API call

Running sentiment over customer reviews or support tickets by hand doesn't scale. Spinning up your own ML pipeline — model download, inference server, GPU costs — is overkill for most products.

One POST gives you sentiment, a confidence score, and an explanation in JSON:

curl --request POST \
  --url 'https://api.sprytools.com/v1/ai/api/v1/sentiment' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: YOUR_API_KEY' \
  --data '{"text":"The onboarding flow is confusing and support was slow to respond."}'
Enter fullscreen mode Exit fullscreen mode

Response: { "sentiment": "negative", "score": 0.87, "explanation": "…" }. Score is 0.0–1.0 (1.0 = strongest polarity), sentiment is one of "positive", "negative", or "neutral".

To build a simple feedback dashboard, batch your review rows and aggregate by sentiment:

async function scoreReview(text) {
  const res = await fetch('https://api.sprytools.com/v1/ai/api/v1/sentiment', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': process.env.SPRYTOOLS_API_KEY,
    },
    body: JSON.stringify({ text }),
  });
  return res.json(); // { sentiment, score, explanation }
}

const scores = await Promise.all(reviews.map(r => scoreReview(r.text)));
const tally = scores.reduce((acc, s) => {
  acc[s.sentiment] = (acc[s.sentiment] ?? 0) + 1;
  return acc;
}, {});
// { positive: 42, neutral: 11, negative: 8 }
Enter fullscreen mode Exit fullscreen mode

The same API covers four more operations with no additional key or infra: keyword extraction (/api/v1/keywords[{ word, score, frequency }]), named-entity recognition (/api/v1/entities → types: PERSON, LOCATION, ORGANIZATION, DATE, OTHER), custom category classification (/api/v1/classify → pass your own categories[]), and summarization (/api/v1/summarize{ summary, sentences[], wordCount }) — all POST, all under the same /v1/ai/ prefix. Max input is 16 000 characters per request.

Free key: 100 calls/day, no credit card — https://sprytools.com/apis/ai/

Do you run sentiment analysis in production today, and what's powering it?

Top comments (0)