
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@hazeljs/messaging
Advanced tools
Multichannel messaging for HazelJS - WhatsApp, Telegram, Viber with LLM-powered bot responses
Multichannel messaging for HazelJS: WhatsApp, Telegram, Viber with LLM-powered bot responses.
IncomingMessage / OutgoingMessage@hazeljs/ai providers (OpenAI, Anthropic, etc.) for conversational responsesnpm install @hazeljs/messaging @hazeljs/ai @hazeljs/core
For Redis context (horizontal scaling):
npm install ioredis
For Kafka async processing (horizontal scaling):
npm install @hazeljs/kafka
For Viber support:
npm install viber-bot
import { HazelApp } from '@hazeljs/core';
import { MessagingModule } from '@hazeljs/messaging';
import { OpenAIProvider } from '@hazeljs/ai';
const app = new HazelApp({
imports: [
MessagingModule.forRoot({
aiProvider: new OpenAIProvider(process.env.OPENAI_API_KEY),
systemPrompt: 'You are a helpful support assistant. Keep responses concise.',
model: 'gpt-4o-mini',
channels: {
telegram: { botToken: process.env.TELEGRAM_BOT_TOKEN! },
whatsapp: {
accessToken: process.env.WHATSAPP_ACCESS_TOKEN!,
phoneNumberId: process.env.WHATSAPP_PHONE_NUMBER_ID!,
},
},
}),
],
});
app.listen(3000);
For horizontal scalability, use Redis for context and Kafka for async processing:
import Redis from 'ioredis';
MessagingModule.forRoot({
aiProvider: new OpenAIProvider(),
channels: { telegram: { botToken: process.env.TELEGRAM_BOT_TOKEN! } },
redis: {
host: process.env.REDIS_HOST ?? 'localhost',
port: parseInt(process.env.REDIS_PORT ?? '6379', 10),
password: process.env.REDIS_PASSWORD,
ttlSeconds: 86400, // 24h
},
kafka: {
brokers: (process.env.KAFKA_BROKERS ?? 'localhost:9092').split(','),
},
});
| Channel | Method | URL |
|---|---|---|
| Telegram | POST | /api/messaging/webhook/telegram |
| GET | /api/messaging/webhook/whatsapp (verification) | |
| POST | /api/messaging/webhook/whatsapp | |
| Viber | POST | /api/messaging/webhook/viber |
aiProvider – IAIProvider from @hazeljs/ai (e.g. OpenAIProvider)systemPrompt – System prompt for the LLMmodel – Model name (default: gpt-4o-mini)temperature – 0–1 (default: 0.7)maxTokens – Max response tokens (default: 500)maxContextTurns – Conversation turns to keep (default: 10)customHandler – Override LLM with a custom (msg) => string | Promise<string>channels – Channel config (see below)WHATSAPP_VERIFY_TOKEN in env for webhook verificationaccessToken, phoneNumberId from Meta for Developershttps://api.telegram.org/bot<token>/setWebhook?url=https://your-domain/api/messaging/webhook/telegramnpm install viber-botUse a knowledge base to ground responses. Compatible with @hazeljs/rag RAGService:
import { RAGService } from '@hazeljs/rag';
// ... set up RAGService with vector store, embeddings, etc.
MessagingModule.forRoot({
aiProvider: new OpenAIProvider(),
ragService: myRAGService,
ragTopK: 5,
ragMinScore: 0.5,
channels: { telegram: { botToken: process.env.TELEGRAM_BOT_TOKEN! } },
});
Wire your CSRService or AgentRuntime for full control—tools, RAG, external lookups:
import { MessagingModule } from '@hazeljs/messaging';
import { CSRService } from './csr'; // your CSRService like hazeljs-csr-example
const csrService = new CSRService(...);
MessagingModule.forRoot({
agentHandler: async ({ message, sessionId }) => {
const result = await csrService.chat(message.text, sessionId, message.userId);
return { response: result.response, sources: result.sources };
},
channels: { telegram: { botToken: process.env.TELEGRAM_BOT_TOKEN! } },
});
The agent handler receives { message, sessionId, conversationTurns } and can:
AgentRuntime.execute() with tools and RAGstring or { response, sources }MessagingModule.forRoot({
customHandler: async (msg) => {
if (msg.text === '/help') return 'Available commands: /help, /status';
return 'Use /help for commands.';
},
});
Implement IChannelAdapter and register via providers.
FAQs
Multichannel messaging for HazelJS - WhatsApp, Telegram, Viber with LLM-powered bot responses
The npm package @hazeljs/messaging receives a total of 567 weekly downloads. As such, @hazeljs/messaging popularity was classified as not popular.
We found that @hazeljs/messaging 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.