A lightweight, embeddable JavaScript plugin that enables voice and chat capabilities powered by Everworker AI agents on any website.
- ποΈ Real-time Voice Communication - WebRTC-based voice streaming with OpenAI Realtime API
- π¬ Dual Voice & Text Chat - Seamless switching between voice and text input
- π Easy Integration - Simple script tag or npm package installation
- π¨ Customizable UI - Minimal floating button with expandable chat interface
- π Secure - Server-side API key management with ephemeral tokens
- π± Responsive - Works on desktop and mobile devices
- π Multiple Connection Modes - DDP (real-time) with REST API fallback
<script src="https://cdn.everworker.ai/voice-plugin.min.js"></script>
<script>
EverworkerVoice.init({
endpoint: 'wss://your-instance.everworker.ai',
workerId: 'your-worker-id',
token: 'your-public-token'
});
</script>npm install @everworker/voice-pluginimport { EverworkerVoice } from '@everworker/voice-plugin';
const voice = new EverworkerVoice({
endpoint: 'wss://your-instance.everworker.ai',
workerId: 'your-worker-id',
auth: {
type: 'token',
token: 'your-token'
}
});
await voice.connect();interface PluginConfig {
// Required
endpoint: string; // Everworker instance URL
workerId: string; // Universal Worker ID
// Authentication
auth?: {
type: 'token' | 'jwt' | 'anonymous';
token?: string | (() => Promise<string>);
};
// UI Customization
ui?: {
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
theme?: 'light' | 'dark' | 'auto';
primaryColor?: string;
container?: HTMLElement; // Custom container instead of floating button
};
// Features
features?: {
voice?: boolean; // Enable voice input (default: true)
text?: boolean; // Enable text input (default: true)
persistence?: 'none' | 'session' | 'local'; // Chat history persistence
};
// Callbacks
callbacks?: {
onConnect?: () => void;
onDisconnect?: () => void;
onMessage?: (message: Message) => void;
onError?: (error: Error) => void;
};
}// Initialize the plugin
EverworkerVoice.init(config);
// Connection management
await voice.connect();
voice.disconnect();
// Send messages
voice.sendMessage('Hello!');
// Voice control
voice.startVoiceInput();
voice.stopVoiceInput();
// UI control
voice.show();
voice.hide();
voice.minimize();
voice.expand();
// Event handling
voice.on('message', (msg) => console.log(msg));
voice.off('message', handler);
// Cleanup
voice.destroy();connect- Connected to Everworker backenddisconnect- Disconnected from backendmessage- New message receivederror- Error occurredstateChange- Connection state changedtranscription- Voice transcription available
const voice = new EverworkerVoice({
// ... other config
ui: {
theme: 'custom',
customStyles: `
.ew-chat-button { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.ew-chat-message { font-family: 'Inter', sans-serif; }
`
}
});// Customer support bot
const supportBot = new EverworkerVoice({
workerId: 'support-agent',
ui: { position: 'bottom-right' }
});
// Sales assistant
const salesBot = new EverworkerVoice({
workerId: 'sales-agent',
ui: { position: 'bottom-left' }
});// Listen for specific keywords
voice.on('transcription', (text) => {
if (text.includes('help')) {
voice.sendMessage('I can help you with that!');
}
});
// Custom authentication flow
const voice = new EverworkerVoice({
auth: {
type: 'jwt',
token: async () => {
const response = await fetch('/api/get-everworker-token');
const { token } = await response.json();
return token;
}
}
});- Chrome 90+
- Firefox 88+
- Safari 14.1+
- Edge 90+
Voice features require:
- WebRTC support
- Secure context (HTTPS)
- Microphone permissions
# Clone the repository
git clone https://github.com/Integrail/everworker-voice-plugin.git
cd everworker-voice-plugin
# Install dependencies
npm install
# Development mode with watch
npm run dev
# Build for production
npm run build
# Run tests
npm testMIT
For issues and questions:
- GitHub Issues: everworker-voice-plugin/issues
- Documentation: everworker.ai/docs/voice-plugin