Analyze sentiment
post/api/v1/sentiment
Request Body
| Field | Type | Description |
|---|---|---|
textrequired | string | Text to analyze (max 140 characters)(min: 1, max: 140) |
Response
| Field | Type | Description |
|---|---|---|
sentimentrequired | "negative" | "neutral" | "positive" | Predicted sentiment label |
scorerequired | number | Score from -1 (bearish) to +1 (bullish) |
confidencerequired | "low" | "medium" | "high" | Confidence of the prediction |
cachedrequired | boolean | Whether the result was served from this user's cache |
Status Codes
200Sentiment analysis result
401Invalid or missing API key
402Insufficient credits
429Too many requests
Request
import { BitBabbleClient } from "bitbabble";
const client = new BitBabbleClient("bb_your_api_key_here");
const result = await client.sentiment("I love this product!");
console.log(result);Response200
{
"sentiment": "positive",
"score": 0.82,
"confidence": "high",
"cached": false
}