@hearsay/core
v1.0.0
Published
Hearsay SDK — voice interviews, telemetry, session replay, feedback widget
Readme
@hearsay/core
The SDK for Hearsay — AI-powered in-product feedback with voice interviews, telemetry, session replay, and an embedded feedback widget.
Install
For React/Next.js apps (recommended):
npm install @hearsay/react@hearsay/react includes @hearsay/core as a dependency — no need to install both.
Usage
import { Hearsay } from '@hearsay/react';
export default function HearsayWidget() {
return <Hearsay apiKey="hsk_pub_..." />;
}The <Hearsay /> component handles the full SDK lifecycle — no useEffect needed.
For vanilla JavaScript apps using ESM imports:
npm install @hearsay/coreimport { Hearsay } from '@hearsay/core';
Hearsay.init({
apiKey: 'hsk_pub_...',
remoteConfig: true,
});Common configuration
import { Hearsay } from '@hearsay/core';
Hearsay.init({
apiKey: 'hsk_pub_...',
widget: {
position: 'bottom-right', // also bottom-left, top-right, top-left
buttonText: 'Feedback',
theme: {
colors: { primary: '#6366f1' },
},
},
collector: { // Telemetry
console: true,
network: true,
clicks: true,
errors: true,
performance: true,
},
triggers: [ // When to show the widget
{ type: 'exit-intent' },
{ type: 'scroll', scrollDepth: 80 },
],
debug: true,
});API
hearsay.show(); // Show widget
hearsay.show({ question: 'How was checkout?' });
hearsay.hide(); // Hide widget
hearsay.identify('user-123', { email: '[email protected]', plan: 'pro' });
hearsay.track('purchase_completed'); // Custom events
hearsay.addTrigger({ type: 'event', eventName: 'upgrade_clicked' });
hearsay.on((event) => console.log(event));
hearsay.grantConsent(); // GDPR consent mode
hearsay.revokeConsent();
hearsay.hasConsent();
hearsay.destroy(); // Clean upRelated packages
@hearsay/react— React provider, hooks, and components
Links
License
MIT
