convez.ai
MCP ServerIntegração & APIsIntermediário
gambletan

Unified Channel Hub

gambletan/unified-channel-hub

Camada de comunicação unificada para assistentes IA — 27 adaptadores em uma API embarcável

Ver no GitHub
BomPluginScore · de 0 a 100

MCP server que unifica a comunicação entre IA pessoais e múltiplos canais (IM, email, voz, calendário, IoT) através de uma API centralizada. Implementa gerenciamento de serviços remotos, memória de conversas e saídas ricas, permitindo integrar messaging em qualquer projeto Python, TypeScript, Java ou Rust.

Instalação

$npx convez-ai gambletan/unified-channel-hub

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
1
Acompanhando
0
Saúde
100%
Último commit
há 4 meses
Versão
ts-v0.2.0
Issues abertas
0
Contribuidores
5

Casos de uso

  • Integrar múltiplos canais (Telegram, Discord, Slack, Teams, WhatsApp) em um único assistente
  • Expor funções de serviço como comandos via chat (ServiceBridge para controle remoto)
  • Gerenciar conversas com histórico persistente e suporte a streaming/typing indicators

Veredito

Projeto maduro e multilingue que resolve o problema real de unificar canais heterogêneos de forma embarcável. Diferencia-se por ser biblioteca, não plataforma — perfeito para quem precisa de messaging em projetos existentes sem arquitetura opinada.

README

A tradução para o português deste README ainda está na fila.

CI PyPI npm License: MIT Python 3.10+ Node 18+ Rust

unified-channel

Communication layer for personal AI assistants — IM, Email, Voice, Calendar, IoT in one unified API. Python + TypeScript + Java + Rust.

27 adapters across 5 categories. ServiceBridge, conversation memory, rich output, and streaming. Not a chatbot platform — a library you pip install / npm install / Maven-add / cargo add into your project and call manager.run().

Why This Exists

ProjectWhat it isThe gap
OpenClaw / NanobotFull AI agent frameworksToo heavy if you just need messaging. You get an entire runtime, config system, and opinionated agent loop.
Botpress / HexabotChatbot platformsNot embeddable. You build inside their platform, not yours.
LangBotAI-to-IM bridgeNo ServiceBridge (remote function control), no conversation memory, no rich output, no streaming.
unified-channelLightweight library you embed in YOUR projectThat's the point — there is no gap.

unified-channel gives you the messaging plumbing so you can focus on your actual logic: service management, AI agents, alerting, customer support, community bots — whatever.

Feature Highlights

FeatureWhat it does
27 Adapters, 5 CategoriesIM: Telegram, Discord, Slack, WhatsApp, iMessage, Matrix, Teams, LINE, Feishu, Mattermost, Google Chat, Nextcloud, Synology, Zalo, Nostr, BlueBubbles, Twitch, IRC · Email: Gmail/IMAP · Voice: Twilio Voice · SMS: Twilio SMS · Calendar: Google Calendar · IoT: Home Assistant
ServiceBridgeExpose any function as a chat command. Your phone becomes a remote control for your services.
ConversationMemoryPer-user/per-channel conversation history. In-memory, SQLite, or Redis backends.
RichReplySend buttons, carousels, images, files — auto-degrades gracefully on platforms that don't support them.
StreamingTyping indicators + chunked message delivery for long-running responses.
MCP ServerAI agents (Claude, GPT, local LLMs) control your services via standard MCP tool calls.
4 LanguagesPython, TypeScript, Java, Rust — same architecture, same API shape.

Core Value: A Remote Control Panel in Your Pocket

Any Service + unified-channel = full remote management via IM.

You have a service running somewhere — a deployment pipeline, a monitoring stack, a home automation system, a GPU cluster. You want to check on it, restart things, view logs, run commands — but you're on your phone, on a train, at dinner.

With unified-channel's ServiceBridge, you expose your service functions as chat commands in 4 lines:

from unified_channel import ChannelManager, ServiceBridge
from unified_channel.adapters.telegram import TelegramAdapter

manager = ChannelManager()
manager.add_channel(TelegramAdapter("BOT_TOKEN"))

bridge = ServiceBridge(manager)
bridge.expose("deploy", deploy_service, description="Deploy service")
bridge.expose("logs", get_logs, description="View logs")
bridge.expose("restart", restart_service, description="Restart service")
bridge.expose("metrics", get_metrics, description="View metrics")

await manager.run()

Now from your phone (Telegram, Discord, wherever):

/deploy prod v2.1     → ✅ deployed to prod
/logs api --tail 50   → [last 50 log lines]
/restart worker-3     → ✅ restarted
/metrics              → CPU: 23% | Mem: 4.2GB | QPS: 1.2k

This is not a chatbot framework. It's a remote control plane for your services that happens to use IM as the transport. Your phone becomes a terminal to anything you can write a Python/TypeScript/Java function for.

And because it supports MCP, AI agents can control your services too — same exposed functions, accessible as MCP tools.

┌──────────────────────────────────────────────┐
│               unified-channel                │
│                                              │
│  Your Phone (IM)  ──→  ServiceBridge  ──→  Your Service
│  AI Agent (MCP)   ──→  MCP Server    ──→  Functions
│                                              │
│  Telegram │ Discord │ Slack │ WhatsApp       │
│  iMessage │ Matrix  │ Teams │ LINE           │
│  Feishu   │ Mattermost │ Google Chat         │
│  Nextcloud│ Synology│ Zalo  │ Nostr          │
│  BlueBubbles │ Twitch │ IRC                  │
└──────────────────────────────────────────────┘

Conversation Memory

Track per-user, per-channel conversation history with pluggable backends:

from unified_channel import ChannelManager, ConversationMemory
from unified_channel.memory import SQLiteBackend

manager = ChannelManager()
memory = ConversationMemory(backend=SQLiteBackend("conversations.db"))
manager.add_middleware(memory)

@manager.on_message
async def handle(msg):
    history = await memory.get_history(msg.sender_id, limit=10)
    # Pass history to your LLM, search engine, or custom logic
    return generate_response(msg.content.text, history)

Backends: InMemoryBackend (default), SQLiteBackend, RedisBackend. Each stores messages with sender, channel, timestamp, and metadata.

Rich Reply

Send structured content that auto-degrades across platforms:

from unified_channel import RichReply

reply = (
    RichReply("Here are your options:")
    .add_buttons(["Approve", "Reject", "Defer"])
    .add_image("https://example.com/chart.png", alt="CPU usage graph")
    .set_footer("Reply within 24h")
)
return reply

On Telegram: inline keyboard buttons + image. On Slack: Block Kit. On IRC: plain text with numbered options. Each adapter maps rich elements to the best available platform primitive — no manual per-platform logic.

Streaming

Long-running responses get typing indicators and chunked delivery instead of awkward silence:

from unified_channel import StreamingReply

async def handle(msg):
    stream = StreamingReply(msg)
    await stream.start_typing()

    async for chunk in call_llm_streaming(msg.content.text):
        await stream.send_chunk(chunk)

    await stream.finish()

On platforms that support edit-in-place (Telegram, Discord, Slack): the message updates live. On others: chunks are batched and sent at reasonable intervals. Typing indicators are sent automatically during gaps.

Quick Start

Python

pip install unified-channel[telegram]
from unified_channel import ChannelManager, CommandMiddleware
from unified_channel.adapters.telegram import TelegramAdapter

manager = ChannelManager()
manager.add_channel(TelegramAdapter("BOT_TOKEN"))

commands = CommandMiddleware()

@commands.command("status")
async def status(msg):
    return "Agent is running!"

manager.add_middleware(commands)
manager.on_message(lambda msg: f"Echo: {msg.content.text}")

await manager.run()

TypeScript

npm install unified-channel grammy
import { ChannelManager, CommandMiddleware } from "unified-channel";
import { TelegramAdapter } from "unified-channel/adapters/telegram";

const manager = new ChannelManager();
manager.addChannel(new TelegramAdapter("BOT_TOKEN"));

const commands = new CommandMiddleware();
commands.command("status", async () => "Agent is running!");

manager.addMiddleware(commands).onMessage(async (msg) => `Echo: ${msg.content.text}`);

await manager.run();

Java

<dependency>
  <groupId>io.github.gambletan</groupId>
  <artifactId>unified-channel</artifactId>
  <version>0.1.0</version>
</dependency>
var manager = new ChannelManager();
manager.addChannel(new TelegramAdapter("BOT_TOKEN"));

var commands = new CommandMiddleware();
commands.command("status", msg -> HandlerResult.text("Agent is running!"));

manager.addMiddleware(commands);
manager.onMessage(msg -> HandlerResult.text("Echo: " + msg.content().text()));
manager.run();

Architecture

Incoming Message → [Middleware 1] → [Middleware 2] → ... → [Fallback Handler]
                                                                  ↓
                              Adapter.send() ← reply (string or OutboundMessage)

Core concepts:

  • ChannelAdapter: One per platform. Handles connect/disconnect, message parsing, sending.
  • Middleware: Intercepts messages before your handler. Chain them for access control, command routing, logging, rate limiting.
  • ChannelManager: Orchestrates everything. Register adapters, add middleware, set your handler, call run().

Feature Comparison

Featureunified-channelOpenClawBotpressLangBot
Embeddable libraryYesNo (full agent)No (platform)Partial
Channel count2718410
ServiceBridge (remote control)YesNoNoNo
Conversation memoryYesYesYesNo
Rich reply (auto-degrade)YesPartialYesNo
Streaming outputYesYesNoNo
MCP ServerYesNoNoNo
Python + TypeScript + Java + RustYesTS onlyTS onlyPython only
Zero required depsYesNoNoNo

Supported Channels

ChannelProtocolPythonTypeScriptJava
TelegramBot API (polling)YesYesYes
DiscordGateway WebSocketYesYesYes
SlackSocket ModeYesYesYes
WhatsAppCloud API / whatsapp-web.jsYesYesstub
iMessagemacOS SQLite + AppleScriptYesYesstub
MatrixClient-Server APIYesYesstub
MS TeamsBot FrameworkYesYesstub
LINEMessaging APIYesYesstub
Feishu/LarkEvent SubscriptionYesYesstub
MattermostWebSocket + RESTYesYesYes
Google ChatService AccountYesYesstub
Nextcloud TalkREST pollingYesYesstub
Synology ChatWebhookYesYesstub
ZaloOA APIYesYesstub
NostrNIP-04 DMYesYesstub
BlueBubblesREST pollingYesYesstub
TwitchIRC/TMIYesYesstub
IRCRaw IRCYesYesYes
Email (Gmail/IMAP)IMAP + SMTPYesYesstub
Twilio SMSREST + WebhookYesYesstub
Twilio VoiceREST + WebhookYesYesstub
Google CalendarREST API v3YesYesstub
Home AssistantWebSocket APIYesYesstub

Use Cases

  • Remote Service Management (primary): Manage deployments, view logs, restart services, check metrics — all from your phone via Telegram/Discord/Slack. ServiceBridge turns any set of functions into a remote control panel.
  • GPU Cluster / ML Ops: Monitor training jobs, check GPU utilization, cancel runs, pull results — from a chat on your phone.
  • IoT / Home Automation: Control smart home devices, check sensor readings, trigger routines via iMessage, Telegram, or any channel.
  • AI Chat Agents: Deploy your LLM-powered agent across multiple platforms from one codebase.
  • DevOps Alerts: Broadcast CI/CD, monitoring, and incident alerts to Slack, Discord, and Mattermost simultaneously.
  • Customer Support Bots: Unified inbox across Telegram, WhatsApp, LINE, and web chat.
  • Community Management: Single bot logic serving Discord, Telegram, and Matrix communities.

MCP Server (for AI Agents)

Any MCP-compatible agent can control messaging channels as tools:

{
  "mcpServers": {
    "unified-channel": {
      "command": "npx",
      "args": ["@unified-channel/mcp-server"],
      "env": {
        "UC_TELEGRAM_TOKEN": "your-bot-token",
        "UC_DISCORD_TOKEN": "your-bot-token"
      }
    }
  }
}

Available tools: send_message, broadcast_message, get_channel_status, list_channels, get_recent_messages

See mcp-server/README.md for full docs.

Project Structure

unified-channel/
├── python/          # Python implementation (pip install)
├── typescript/      # TypeScript/Node.js implementation (npm install)
├── java/            # Java implementation (Maven)
├── rust/            # Rust implementation (cargo add)
├── mcp-server/      # MCP server for AI agents
├── .github/
│   ├── workflows/   # CI for all languages
│   └── PULL_REQUEST_TEMPLATE.md
└── CONTRIBUTING.md

Contributing

See CONTRIBUTING.md for guidelines. We welcome PRs for:

  • New channel adapters (especially Java stubs to full implementations)
  • Middleware additions (rate limiting, logging, i18n)
  • Bug fixes and documentation improvements
  • Language-specific improvements

License

MIT

Ver o original no GitHub

Bom para

Relacionados