
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
sonic-events
Advanced tools
Function-based TypeScript SDK for tracking events and errors to Discord, Slack, or any webhook
Function-based TypeScript SDK for tracking events and errors to Discord, Slack, or any webhook.
trackEvent() and trackError()npm install sonic-events
# or
yarn add sonic-events
# or
bun add sonic-events
import { AnalyticsWrapper } from 'sonic-events';
function App() {
return (
<AnalyticsWrapper
webhook="https://discord.com/api/webhooks/..."
appName="MyApp"
captureErrors={true}
>
<YourApp />
</AnalyticsWrapper>
);
}
import { useAnalytics } from 'sonic-events';
function PaywallScreen() {
const { trackEvent } = useAnalytics();
const handleUpgrade = () => {
trackEvent('paywall_opened', {
source: 'home',
plan: 'premium'
});
};
return <Button onPress={handleUpgrade}>Upgrade</Button>;
}
import { useAnalytics } from 'sonic-events';
function CheckoutScreen() {
const { trackError } = useAnalytics();
const processPayment = async () => {
try {
await charge();
} catch (error) {
trackError(error, {
component: 'CheckoutScreen',
action: 'processPayment'
});
}
};
}
<AnalyticsWrapper>Main provider component that wraps your app.
Props:
webhook (required) - Your webhook URL (Discord/Slack/generic)appName (optional) - Name of your app (included in all events)userId (optional) - User identifier for tracking per-user eventscaptureErrors (optional) - Auto-catch React errors (default: true)enableInDev (optional) - Send events in dev mode (default: false, logs to console instead)<AnalyticsWrapper
webhook="https://discord.com/api/webhooks/your-webhook"
appName="MyApp"
userId="user123"
captureErrors={true}
enableInDev={false}
>
<App />
</AnalyticsWrapper>
useAnalytics()Hook to access tracking functions from context.
Returns:
trackEvent(eventName, metadata?) - Track custom eventstrackError(error, context?) - Track errorsconfig - Current analytics configurationconst { trackEvent, trackError, config } = useAnalytics();
trackEvent(eventName, metadata?, config?)Track any custom event in your app.
Parameters:
eventName (string) - Name of the event (e.g., 'paywall_opened')metadata (object, optional) - Additional data about the eventconfig (object, optional) - Override global config for this eventExamples:
trackEvent('user_signup');
trackEvent('purchase_completed', { amount: 9.99, plan: 'premium' });
trackEvent('feature_used', { feature: 'export' });
trackError(error, context?, config?)Track errors in your app.
Parameters:
error (Error) - Error object to trackcontext (object, optional) - Additional context about the errorconfig (object, optional) - Override global config for this errorExamples:
try {
await riskyOperation();
} catch (error) {
trackError(error, {
component: 'PaymentScreen',
userId: user.id
});
}
Automatically formats as rich embeds with colors and emojis:
Formats using Block Kit for modern, rich messages:
Clean JSON format for any webhook service:
Example payload:
{
"event_type": "analytics_event",
"timestamp": "2025-12-03T10:30:00Z",
"app_name": "MyApp",
"user_id": "user123",
"data": {
"event_name": "paywall_opened",
"metadata": { "source": "home" }
}
}
Full TypeScript support with exported types:
import type {
AnalyticsConfig,
AnalyticsEvent,
ErrorEvent
} from 'sonic-events';
By default, events are NOT sent to webhooks in development - they're logged to console instead.
To enable webhook sending in development:
<AnalyticsWrapper
webhook="..."
enableInDev={true}
>
The SDK includes a silent ErrorBoundary that catches React errors and reports them without showing UI to users.
Enable it:
<AnalyticsWrapper captureErrors={true}>
Or use the ErrorBoundary directly:
import { ErrorBoundary } from 'sonic-events';
<ErrorBoundary config={{ webhook: '...' }}>
<App />
</ErrorBoundary>
MIT
Your Name
FAQs
Function-based TypeScript SDK for tracking events and errors to Discord, Slack, or any webhook
We found that sonic-events 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.