
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@sharpapi/sharpapi-node-product-review-sentiment
Advanced tools
SharpAPI.com Node.js SDK for analyzing product review sentiment

SharpAPI Product Review Sentiment Analyzer uses advanced AI to determine if product reviews are positive, negative, or neutral with confidence scores. Perfect for e-commerce platforms, review management, and customer feedback analysis.
npm install @sharpapi/sharpapi-node-product-review-sentiment
Visit SharpAPI.com to get your API key.
const { SharpApiProductReviewSentimentService } = require('@sharpapi/sharpapi-node-product-review-sentiment');
const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiProductReviewSentimentService(apiKey);
const review = `
This product exceeded my expectations! The quality is outstanding and delivery was fast.
I highly recommend it to anyone looking for a reliable solution.
`;
async function analyzeReview() {
try {
// Submit sentiment analysis job
const statusUrl = await service.analyzeSentiment(review);
console.log('Job submitted. Status URL:', statusUrl);
// Fetch results (polls automatically until complete)
const result = await service.fetchResults(statusUrl);
const sentiment = result.getResultJson();
console.log('Sentiment:', sentiment.opinion);
console.log('Confidence:', sentiment.score + '%');
} catch (error) {
console.error('Error:', error.message);
}
}
analyzeReview();
analyzeSentiment(reviewText: string): Promise<string>Analyzes the sentiment of a product review.
Parameters:
reviewText (string, required): The review text to analyzeReturns:
Example:
const statusUrl = await service.analyzeSentiment(customerReview);
const result = await service.fetchResults(statusUrl);
The API returns sentiment classification with confidence score:
{
"opinion": "POSITIVE",
"score": 95,
"key_phrases": [
"exceeded expectations",
"outstanding quality",
"highly recommend"
]
}
Sentiment Values:
POSITIVE: Review expresses satisfaction or praiseNEGATIVE: Review expresses dissatisfaction or criticismNEUTRAL: Review is balanced or factual without strong opinionconst { SharpApiProductReviewSentimentService } = require('@sharpapi/sharpapi-node-product-review-sentiment');
const service = new SharpApiProductReviewSentimentService(process.env.SHARP_API_KEY);
const review = 'The product broke after 2 days. Very disappointed with the quality.';
service.analyzeSentiment(review)
.then(statusUrl => service.fetchResults(statusUrl))
.then(result => {
const sentiment = result.getResultJson();
const emoji = sentiment.opinion === 'POSITIVE' ? '😊' :
sentiment.opinion === 'NEGATIVE' ? '😞' : '😐';
console.log(`${emoji} Sentiment: ${sentiment.opinion} (${sentiment.score}% confidence)`);
})
.catch(error => console.error('Analysis failed:', error));
const service = new SharpApiProductReviewSentimentService(process.env.SHARP_API_KEY);
const reviews = [
{ id: 1, text: 'Amazing product! Love it.' },
{ id: 2, text: 'Not worth the money, poor quality.' },
{ id: 3, text: 'Good product, fast shipping.' },
{ id: 4, text: 'Terrible experience, would not buy again.' }
];
const analyzed = await Promise.all(
reviews.map(async (review) => {
const statusUrl = await service.analyzeSentiment(review.text);
const result = await service.fetchResults(statusUrl);
const sentiment = result.getResultJson();
return {
id: review.id,
text: review.text,
sentiment: sentiment.opinion,
score: sentiment.score
};
})
);
const positive = analyzed.filter(r => r.sentiment === 'POSITIVE').length;
const negative = analyzed.filter(r => r.sentiment === 'NEGATIVE').length;
console.log(`Positive reviews: ${positive}/${analyzed.length}`);
console.log(`Negative reviews: ${negative}/${analyzed.length}`);
const service = new SharpApiProductReviewSentimentService(process.env.SHARP_API_KEY);
async function analyzeProductReviews(productId, reviews) {
const sentiments = await Promise.all(
reviews.map(async (review) => {
const statusUrl = await service.analyzeSentiment(review.text);
const result = await service.fetchResults(statusUrl);
return result.getResultJson();
})
);
const positiveCount = sentiments.filter(s => s.opinion === 'POSITIVE').length;
const negativeCount = sentiments.filter(s => s.opinion === 'NEGATIVE').length;
const neutralCount = sentiments.filter(s => s.opinion === 'NEUTRAL').length;
const avgScore = sentiments.reduce((sum, s) => sum + s.score, 0) / sentiments.length;
return {
productId,
totalReviews: reviews.length,
positive: positiveCount,
negative: negativeCount,
neutral: neutralCount,
averageConfidence: Math.round(avgScore),
overallSentiment: positiveCount > negativeCount ? 'POSITIVE' : 'NEGATIVE'
};
}
const productReviews = [
{ text: 'Great quality, very satisfied!' },
{ text: 'Perfect for my needs.' },
{ text: 'Not as described, disappointed.' }
];
const dashboard = await analyzeProductReviews('PROD-123', productReviews);
console.log('Product Sentiment Dashboard:', dashboard);
The analyzer evaluates multiple factors:
POST /ecommerce/review_sentiment
For detailed API specifications, refer to:
This project is licensed under the MIT License. See the LICENSE.md file for details.
Powered by SharpAPI - AI-Powered API Workflow Automation
FAQs
SharpAPI.com Node.js SDK for analyzing product review sentiment
The npm package @sharpapi/sharpapi-node-product-review-sentiment receives a total of 0 weekly downloads. As such, @sharpapi/sharpapi-node-product-review-sentiment popularity was classified as not popular.
We found that @sharpapi/sharpapi-node-product-review-sentiment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.