@anvia/channel
The neutral core: addresses, events, messages, validation, and delivery helpers shared by every adapter.
sendChannelMessage()Platform-neutral channel adapters for Anvia agents or ordinary application code. Receive where your users already are, or deliver proactively from workers, monitors, and scheduled jobs without starting an agent. The five libraries are in beta while live-platform verification completes.
One neutral core that models channels, events, and delivery — and one thin adapter per platform on top.
The neutral core: addresses, events, messages, validation, and delivery helpers shared by every adapter.
sendChannelMessage()The bridge: runs an existing Anvia agent behind any channel adapter with sessions, streaming, and approvals handled.
createChannelAgent()Discord Gateway input and REST delivery with buttons, files, threads, and typing indicators.
discord()Slack Socket Mode input and Web API delivery with Block Kit actions, files, and threads.
slack()Telegram long polling or webhook input with Bot API delivery and inline keyboards.
telegram()The bridge owns the mechanics platforms differ on — sessions, streaming, splitting, actions — so your agent sees one consistent conversation shape.
Create a platform adapter with its credentials — discord(), slack(), or telegram() — and the receive transport is wired.
Pass the adapter and your existing Anvia agent to createChannelAgent() and start the returned service.
Default message filtering, stable conversation sessions, multimodal prompts, streaming edits, long-message splitting, native actions, and paused approval or question flows.
Stop gracefully with service.stop(), or skip receiving entirely and deliver proactively from workers and scheduled jobs.
Create a platform adapter, pass it and an existing Anvia agent to createChannelAgent(), and start the returned service. The agent itself does not change.
Run the bridge in your application. You configure credentials, choose the agent's memory store and retention policy, and enforce authorization in your tools. Channel adapters handle message delivery.
Read the end-to-end guide1import { createChannelAgent } from '@anvia/channel-agent'2import { telegram } from '@anvia/telegram'34const channel = telegram({ token: process.env.TELEGRAM_BOT_TOKEN! })5const service = createChannelAgent({6 channel,7 agent,8 streaming: { placeholder: 'Thinking…' },9})1011await service.start()1213process.once('SIGTERM', () => {14 void service.stop()15})An alerting or worker process only needs a platform adapter and sendChannelMessage(). Long text is split for the selected platform, and native actions ride along. Receiving never has to be started.
1import { sendChannelMessage } from '@anvia/channel'2import { discord } from '@anvia/discord'34const channel = discord({ token: process.env.DISCORD_BOT_TOKEN! })56await sendChannelMessage(7 channel,8 { platform: 'discord', conversationId: process.env.DISCORD_CHANNEL_ID! },9 {10 text: monitoringReport,11 actions: [{ id: 'incident:ack', label: 'Acknowledge', style: 'primary' }],12 },13)Incoming external payloads are validated at runtime and normalized into ChannelEvent values. Optional operations are advertised through channel.capabilities. All three adapters expose message edits, deletion, and reactions.
Receive transport: Gateway.
filesbuttonsreplies + threadstypingedits + reactionsReceive transport: Socket Mode.
filesBlock Kit buttonsreplies + threadsedits + reactionsReceive transport: Long polling or webhook.
filesinline keyboardreplies + threadstypingedits + reactionsThe workspace ships complete Discord, Slack, and Telegram agents with OpenAI models and persistent SQLite conversation memory.
Browse the examplesNode.js 24+ and pnpm 11. Run pnpm install at the repository root to link all five packages.
Copy the example .env.example for your platform and set its bot or app tokens plus OPENAI_API_KEY.
Run pnpm example:discord, pnpm example:slack, or pnpm example:telegram and message the bot.
Start from a working example, bridge the agent your product already runs, then read how the five packages divide the work.