An adapter and one function call. No receive loop.

An alerting or worker process only needs a platform adapter and sendChannelMessage(). Receiving never has to be started, long text is split to the platform’s limit, and buttons and attachments ride along on the final part.

From report to delivered message.

No agent is required. Any process that has a token can send.

  1. 01

    Create an adapter

    Create the Discord, Slack, or Telegram adapter. Do not start it.

  2. 02

    Address the conversation

    Name the platform and the conversation ID to deliver to.

  3. 03

    Send the message

    sendChannelMessage() delivers text, actions, and attachments, split in order.

  4. 04

    Handle partial delivery

    Record the returned message IDs. A partial failure reports what was sent so a retry can resume.

Delivery that holds up.

Send-only processes

Workers and cron jobs send without starting a receive loop they would have to stop.

Automatic splitting

Long reports are split to each platform’s limit and sent in order.

Actions and attachments

Add buttons such as Acknowledge or Dismiss, and attach files inline or by URL.

Resumable retries

PartialDeliveryError reports the sent parts and the failed one, so retries do not resend.

Send a monitoring report to Discord.

The Acknowledge button arrives as an action event in any process that receives.

worker.ts
1import { sendChannelMessage } from '@anvia/channel'2import { discord } from '@anvia/discord'34const channel = discord({ token: process.env.DISCORD_BOT_TOKEN! })56await sendChannelMessage({7  channel,8  address: { platform: 'discord', conversationId: process.env.DISCORD_CHANNEL_ID! },9  message: {10    text: monitoringReport,11    actions: [{ id: 'incident:ack', label: 'Acknowledge', style: 'primary' }],12  },13})

Channels is in beta and its packages are not published to npm yet. When a user or model can choose an attachment URL, pass a restricted fetch that allowlists origins and blocks private networks.

Build it.

Start from the guide, run the example, or look at what else Anvia handles.

Anvia