Aviary
Packages

@dudousxd/nestjs-agent-channels

The agent on text channels (WhatsApp through Evolution API, Whatsmiau or the Cloud API, and Telegram), one webhook route per channel.

pnpm add @dudousxd/nestjs-agent-channels

AgentChannelsModule mounts one webhook route per channel. Each route verifies the request, deduplicates by the provider's message id, answers 200 at once and runs the turn in the background. The reply is converted to the channel's markdown and split at its length limit. Pending proposals arrive as buttons (or a text instruction), questions as numbered text, media as staged attachments. Peers: @dudousxd/nestjs-agent and @dudousxd/nestjs-agent-core. The adapters use the global fetch.

The full guide is Text channels.

Minimal example

import { AgentChannelsModule, telegram } from '@dudousxd/nestjs-agent-channels';

AgentChannelsModule.forRoot({
  channels: [
    {
      adapter: telegram({ botToken: process.env.TELEGRAM_BOT_TOKEN, secretToken: process.env.TELEGRAM_SECRET }),
      actor: (message) => accounts.forTelegram(message.from), // null → not answered
      thread: (actor, message) => threads.get(message.conversation), // null → a new thread
      onThreadCreated: (threadId, actor, message) => threads.set(message.conversation, threadId),
    },
  ],
});
// POST /channels/telegram

AgentChannelsModule.forRoot(options)

OptionDefaultPurpose
channels—One entry per channel: adapter, actor, thread, hooks. See Options.
storeAGENT_CHANNEL_STORE when bound, else memoryMessage ids, questions in progress, relayed outcomes. The Drizzle and MikroORM store modules bind one; RedisChannelStore from -transport-redis works too.
durableon when the agent runs on the aviary durable enginefalse handles messages in this process; an engine runs them there. See Durable processing.
path'channels'Routes are /<path>/<name>. false mounts none: call AgentChannelsService.handle(name, req, res) from your own controller.
decorators[]Class decorators applied to the webhook controller. The controller carries CanAnyone(); a @Can() passed here is still checked.

forRootAsync({ imports, inject, useFactory, path?, decorators? }) takes the same options, with path and decorators kept static.

Exports

ExportPurpose
AgentChannelsModule, AgentChannelsService, AgentChannelsControllerThe module, the service behind the route, and the controller to extend.
evolutionApi, whatsmiau, whatsappCloud, telegramThe built-in adapters. Any ChannelAdapter works.
ptBrChannelTexts, DEFAULT_CHANNEL_TEXTS, mergeChannelTextsThe texts the channel sends. See Language.

On this page