Send-only processes
Workers and cron jobs send without starting a receive loop they would have to stop.
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.
No agent is required. Any process that has a token can send.
Create the Discord, Slack, or Telegram adapter. Do not start it.
Name the platform and the conversation ID to deliver to.
sendChannelMessage() delivers text, actions, and attachments, split in order.
Record the returned message IDs. A partial failure reports what was sent so a retry can resume.
Workers and cron jobs send without starting a receive loop they would have to stop.
Long reports are split to each platform’s limit and sent in order.
Add buttons such as Acknowledge or Dismiss, and attach files inline or by URL.
PartialDeliveryError reports the sent parts and the failed one, so retries do not resend.
The Acknowledge button arrives as an action event in any process that receives.
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.
Start from the guide, run the example, or look at what else Anvia handles.