sentilyze
v1.2.0
Published
Official Node.js SDK for Sentilyze.ai - Analyze sentiment and happiness levels from customer feedback with AI
Maintainers
Readme
Sentilyze.ai
Official Node.js SDK for Sentilyze.ai - Analyze support tickets, feedback and reviews to get customer satisfaction and sentiment
Installation
npm install sentilyzeQuick Start
import SentilyzeClient from 'sentilyze';
const client = new SentilyzeClient({ apiKey: 'senti_your_api_key' });
const result = await client.analyze('This product is amazing!');
console.log(result.sentiment); // 'positive'
console.log(result.score); // 5.2Response:
{
sentiment: 'positive',
score: 5.2,
summary: 'Customer expresses high satisfaction with the product',
tags: ['product', 'satisfaction', 'quality']
}Features
- ✅ Sentiment Analysis - Detect positive, negative, or neutral sentiment
- ✅ Happiness Scoring - Measure happiness levels from 1-6 scale
- ✅ AI-Powered Summary - Get concise summaries of feedback
- ✅ Tag Extraction - Automatic keyword and topic extraction
- ✅ Usage Tracking - Monitor your API usage in real-time
- ✅ Error Handling - Comprehensive error messages and retry logic
API Reference
Initialize Client
const client = new SentilyzeClient({
apiKey: 'senti_your_api_key', // Required: Your API key
baseUrl: 'https://api.sentilyze.ai', // Optional: Custom API URL
timeout: 30000 // Optional: Request timeout (ms)
});Analyze Text
Analyze a single text for sentiment and happiness:
// Simple string
const result = await client.analyze('Customer feedback text');
// With options
const result = await client.analyze('Customer feedback text', {
spamcheck: true, // Check for spam (Professional/Enterprise)
reply: true, // Generate auto-reply (Professional/Enterprise)
language: 'en' // Language code (Professional/Enterprise)
});
// With options object
const result = await client.analyze({
feedback: 'Customer feedback text',
spamcheck: true,
reply: true,
language: 'en'
});Response Structure:
{
sentiment: 'positive' | 'negative' | 'neutral',
score: number, // 1-6 scale (decimal)
summary: string, // AI-generated summary
tags: string[], // Extracted keywords
spam: boolean, // If spamcheck was requested
autoReply: string, // If reply was requested
}Example:
const result = await client.analyze('The product quality is excellent, but shipping was slow', {
language: 'en',
reply: true
});
console.log(result.sentiment); // 'positive'
console.log(result.autoReply); // 'Thank you for your feedback...'
console.log(result.score); // 4.5
console.log(result.summary); // 'Mixed feedback with product praise and shipping concerns'
console.log(result.tags); // ['product', 'quality', 'shipping', 'delivery']Get Usage Statistics
Check your current API usage:
const usage = await client.getUsage();
console.log(usage);Response:
{
data: {
requestsUsed: 150,
requestsLimit: 1000,
requestsRemaining: 850,
subscriptionPlan: 'Starter',
resetDate: '2025-12-31T23:59:59.999Z',
currentPeriod: {
month: 12,
year: 2025
}
}
}Error Handling
The SDK provides detailed error handling:
try {
const result = await client.analyze('Text to analyze');
} catch (error) {
if (error.status === 401) {
console.error('Invalid API key');
} else if (error.status === 429) {
console.error('Rate limit exceeded');
} else if (error.message.includes('timeout')) {
console.error('Request timed out');
} else if (error.message.includes('Network error')) {
console.error('Cannot reach API');
} else {
console.error('Analysis failed:', error.message);
}
}Common Use Cases
Customer Feedback Analysis
// Analyze customer review
const review = await client.analyze(
'The product quality is excellent, but shipping was slow'
);
if (review.sentiment === 'positive') {
console.log(`Happy customer! Score: ${review.score}/6`);
console.log(`Summary: ${review.summary}`);
console.log(`Topics: ${review.tags.join(', ')}`);
}Subscription Plans
| Plan | Requests/Month | Price | Best For | |------|----------------|-------|----------| | Developer | 100 | Free | Testing & development | | Starter | 1,000 | $29 | Small projects | | Professional | 10,000 | $199 | Growing businesses | | Enterprise | Unlimited | Custom | Large organizations |
Get your API key at sentilyze.ai
Response Field Descriptions
- sentiment: Classification of the feedback (
positive,negative, orneutral) - score: Happiness/satisfaction score on a 1-6 scale (decimal values like 4.5 are supported)
- 1-2: Very unhappy
- 3-4: Neutral to slightly satisfied
- 5-6: Very happy
- summary: AI-generated concise summary of the feedback
- tags: Array of extracted keywords and topics from the text
- usage: Current API usage information for rate limiting and billing
Support
- 📧 Email: [email protected]
- 🌐 Website: https://www.sentilyze.ai
- 📚 Dashboard: https://www.sentilyze.ai/dashboard
License
MIT © Sentilyze.ai
Made with ❤️ by Sentilyze.ai
