import { EmitKit } from '@emitkit/js';// Initialize the clientconst client = new EmitKit('emitkit_xxxxxxxxxxxxxxxxxxxxx');// Send an eventconst result = await client.events.create({ channelName: 'general', title: 'Hello from EmitKit!', description: 'My first event', icon: '👋'});console.log('Event created:', result.data.id);
Success! You’ve sent your first event. You should see it in your EmitKit dashboard immediately.
import { EmitKit } from '@emitkit/js';const client = new EmitKit('your_api_key');// Get alerted when a user signs upawait client.events.create({ channelName: 'signups', title: 'New user signed up', userId: 'user_123', metadata: { email: 'user@example.com', source: 'google', plan: 'free' }});
// Create user identity with aliasesawait client.identify({ user_id: 'user_123', properties: { email: 'john@example.com', name: 'John Doe', plan: 'pro', signupDate: '2025-01-15' }, aliases: [ 'john@example.com', // Email 'johndoe', // Username 'ext_12345' // External system ID ]});// Now you can reference the user by any aliasawait client.events.create({ channelName: 'activity', title: 'User logged in', userId: 'john@example.com', // ← Alias works!});