VoiceFeedback SDK

A modern, elegant voice recording SDK for collecting user feedback with advanced AI analysis. Features beautiful UI components, real-time transcription, sentiment analysis, and topic extraction.
β¨ Features
- π¨ Modern UI Components - Beautiful, customizable buttons with multiple variants
- π€ High-Quality Recording - Crystal clear audio capture with browser compatibility
- π€ AI-Powered Analysis - Real-time transcription, sentiment analysis, and topic extraction
- β‘ Easy Integration - Simple API for React and vanilla JavaScript
- π± Responsive Design - Works perfectly on desktop, tablet, and mobile
- π§ Highly Customizable - Multiple styles, sizes, and configuration options
- π TypeScript Support - Full type definitions included
π Quick Start
Installation
npm install @voicefeedback/sdk
React Component (Recommended)
import { VoiceFeedbackButton } from '@voicefeedback/sdk/react';
function App() {
return (
<VoiceFeedbackButton
apiKey="your-api-key"
variant="primary"
size="medium"
shape="rounded"
onComplete={(result) => {
console.log('Feedback received:', result);
// Handle the feedback data
}}
onError={(error) => {
console.error('Error:', error);
}}
/>
);
}
Vanilla JavaScript
import VoiceFeedback from '@voicefeedback/sdk';
const recorder = new VoiceFeedback({
apiKey: 'your-api-key',
apiUrl: 'https://quicksass.cool.newstack.be/api',
onComplete: (result) => {
console.log('Transcript:', result.transcript);
console.log('Sentiment:', result.sentiment);
console.log('Topics:', result.topics);
},
onError: (error) => {
console.error('Recording error:', error);
}
});
await recorder.startRecording();
recorder.stopRecording();
π Complete API Reference
VoiceFeedback Class
Constructor Options
interface VoiceFeedbackConfig {
apiKey: string;
apiUrl?: string;
webhookUrl?: string;
language?: string;
maxDuration?: number;
debug?: boolean;
onStart?: () => void;
onStop?: () => void;
onComplete?: (result) => void;
onError?: (error) => void;
}
Methods
await voiceFeedback.startRecording(): Promise<void>
voiceFeedback.stopRecording(): void
voiceFeedback.getStatus(): { isRecording: boolean; duration: number }
await voiceFeedback.testApiKey(): Promise<{ valid: boolean; message: string }>
VoiceFeedback.isSupported(): boolean
VoiceFeedback.quickStart(apiKey: string, options?: Partial<VoiceFeedbackConfig>): Promise<VoiceFeedback>
Response Format
interface VoiceFeedbackResult {
id: string;
transcript: string;
sentiment: 'positive' | 'negative' | 'neutral';
sentimentScore: number;
topics: string[];
emotions?: string[];
duration: number;
language: string;
processingTime: number;
}
React Hooks & Components
useVoiceFeedback Hook
const {
startRecording,
stopRecording,
isRecording,
duration,
isSupported,
error
} = useVoiceFeedback(options: VoiceFeedbackHookOptions);
VoiceFeedbackButton Component
<VoiceFeedbackButton
apiKey="vf_your_api_key"
onComplete={(result) => console.log(result)}
onError={(error) => console.error(error)}
recordingText="Recording..."
idleText="Share Feedback"
className="custom-class"
style={{ padding: '12px 24px' }}
disabled={false}
webhookUrl="https://your-app.com/webhook"
language="en"
maxDuration={180}
debug={true}
/>
π Language Support
The SDK supports automatic language detection and transcription in 50+ languages including:
English | en | Spanish | es | French | fr |
German | de | Italian | it | Portuguese | pt |
Dutch | nl | Russian | ru | Chinese | zh |
Japanese | ja | Korean | ko | Arabic | ar |
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
language: 'es',
onComplete: (result) => {
console.log('TranscripciΓ³n:', result.transcript);
}
});
π§ Advanced Configuration
Custom API URL
For self-hosted or custom deployments:
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
apiUrl: 'https://your-custom-api.com/v1',
debug: true
});
Webhook Integration
Receive real-time notifications when feedback is processed:
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
webhookUrl: 'https://your-app.com/api/voice-feedback',
onComplete: (result) => {
updateUI(result);
}
});
app.post('/api/voice-feedback', express.json(), async (req, res) => {
const { transcript, sentiment, topics } = req.body;
await db.feedback.create({
transcript,
sentiment,
topics,
userId: req.user.id,
createdAt: new Date()
});
res.json({ success: true });
});
Error Handling
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
onError: (error) => {
switch(error.message) {
case 'Microphone access denied':
showMicrophonePermissionDialog();
break;
case 'API request failed: 401':
showApiKeyErrorDialog();
break;
default:
showGenericErrorDialog(error.message);
}
}
});
π§ͺ Testing & Development
Integration Test
Test your API key and configuration:
cd node_modules/@voicefeedback/sdk
npm run test-integration vf_your_api_key_here --debug
Browser Compatibility Check
if (!VoiceFeedback.isSupported()) {
console.log('Browser does not support voice recording');
}
Debug Mode
Enable debug logging during development:
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
debug: true
});
π± Browser Support
- β
Chrome 60+
- β
Firefox 55+
- β
Safari 14+
- β
Edge 79+
- β
Mobile Chrome/Safari
- β Internet Explorer (not supported)
π Security & Privacy
- All audio data is transmitted securely over HTTPS
- Audio is processed on secure servers and not stored permanently
- API keys should be kept secure and not exposed in client-side code
- Consider using environment variables for API keys in production
π οΈ Common Integration Patterns
1. Customer Support Widget
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
onComplete: (result) => {
createSupportTicket({
transcript: result.transcript,
sentiment: result.sentiment,
priority: result.sentiment === 'negative' ? 'high' : 'normal'
});
}
});
const floatingButton = document.createElement('button');
floatingButton.innerHTML = 'π€ Feedback';
floatingButton.style.position = 'fixed';
floatingButton.style.bottom = '20px';
floatingButton.style.right = '20px';
floatingButton.onclick = () => vf.startRecording();
document.body.appendChild(floatingButton);
2. Product Feedback Collection
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
onComplete: (result) => {
analyzeProductFeedback({
productId: currentProduct.id,
transcript: result.transcript,
sentiment: result.sentiment,
topics: result.topics
});
}
});
3. User Research & Testing
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
maxDuration: 600,
onComplete: (result) => {
saveResearchSession({
sessionId: currentSession.id,
transcript: result.transcript,
emotions: result.emotions,
topics: result.topics
});
}
});
π Troubleshooting
Common Issues
Recording doesn't start:
- Check microphone permissions in browser
- Verify HTTPS is being used (required for microphone access)
- Test API key with
testApiKey()
method
Poor transcription quality:
- Ensure quiet environment
- Check microphone quality
- Verify correct language is set
API errors:
- Verify API key is correct and active
- Check network connectivity
- Review API rate limits
Debug Information
Enable debug mode to see detailed logging:
const vf = new VoiceFeedback({
apiKey: 'vf_your_api_key',
debug: true
});
π License
MIT License - see LICENSE file for details.
π What's Next?
- Real-time streaming transcription
- Custom voice commands
- Speaker identification
- Advanced emotion detection
- Multi-language detection in single recording
Made with β€οΈ by the VoiceFeedback team
Get Started β’ API Docs β’ Examples