npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bozonx/social-posting-discord

v0.8.0

Published

Discord platform for @bozonx/social-posting

Readme

@bozonx/social-posting-discord

Discord support for @bozonx/social-posting. Zero runtime dependencies, Web APIs only — it runs on Node, Bun, Deno and Cloudflare Workers.

pnpm add @bozonx/social-posting @bozonx/social-posting-discord
import { createPostingClient } from '@bozonx/social-posting';
import { discord } from '@bozonx/social-posting-discord';

const client = createPostingClient({
  platforms: [discord],
  accounts: {
    announcements: {
      platform: 'discord',
      auth: { webhookUrl: process.env.DISCORD_WEBHOOK_URL },
    },
  },
});

await client.post({ platform: 'discord', account: 'announcements', body: 'Ship it.' });

Two access models, and why the difference matters

Discord is the only network in this set where the credential and the destination can be the same string. Pick one per account; an account carrying both is refused rather than guessed at.

| | webhookUrl | botToken | | ----------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | | Setup | Server settings → Integrations. No OAuth, no app review. | A registered application, invited to the server with Send Messages (and Attach Files). | | Destination | Baked into the URL. No target needed. | target.id is the channel id, and it is required. | | Replies | No. | Yes, via inReplyTo. | | Name and avatar | Overridable per message (extra.username, extra.avatar_url). | Fixed, the bot's own. | | Deletes its own messages | Yes, through the webhook token. | Yes, by channel and message id. | | Reads the server's boost tier | No — keeps the unboosted attachment limit. | Yes, through resolveCapabilities(). |

A webhook URL is a secret, not a channel id. Anyone holding it can post to that channel. Store it the way you store a token, never in a column named channelId.

Addressing

The channel is target.id. Two further parts are declared in capabilities.targetSchema:

target: {
  id: '1290000000000000002',      // channel id
  guildId: '1280000000000000003', // server: used for permalinks and boost-tier limits
  threadId: '1295000000000000007' // optional: post into a thread of that channel
}

A scalar target is accepted as shorthand for { id }, but then no permalink can be built: Discord message URLs contain the server id.

What it publishes

| Type | Support | | ------------------------------------- | ----------------------------------------------------------------- | | post | Up to 2 000 characters, Discord-flavoured Markdown. | | image, video, audio, document | One attachment, uploaded as multipart/form-data. | | album | Up to 10 attachments of any mix. | | poll | Native poll: title is the question, poll.options the answers. |

Not supported, because Discord has no such product: shortVideo, story, article, scheduling and drafts. A vertical video is an ordinary attachment.

Media

Discord never fetches a URL — every file is uploaded to it. A url source still works: this adapter downloads it first, which is why the declared transport is both. The URL therefore has to be reachable from your process, not from Discord, and no signed-URL lifetime requirement applies.

Set sensitive: true on a media item to spoiler it. Discord has no flag for this: the adapter prefixes the file name with SPOILER_, which is the mechanism Discord actually uses. altText becomes the attachment description (max 1 024 characters).

Attachment size is a property of the server

The shipped descriptor states the unboosted ceiling of 10 MiB. The real ceiling rises with the server's boost tier, so a bot-token account should ask before publishing:

const resolved = await platform.resolveCapabilities(accountConfig);
// resolved.capabilities.media.video.maxBytes  → 10 / 50 / 100 MiB by boost tier
// resolved.cacheableForSecs                   → 3600

The library caches nothing: it hands the reading back with a lifetime and your host decides where it lives. A webhook account cannot read the server and keeps the floor.

Platform options (extra)

embeds, tts, flags, allowed_mentions, components, plus username and avatar_url for webhook accounts only. Keys the adapter builds itself — content, attachments, poll, message_reference — are refused rather than silently overwritten.

Errors

| Code | When | | ------------------ | ------------------------------------------------------------------------ | | RATE_LIMIT_ERROR | 429, carrying Discord's own retry_after as retryAfterMs. | | AUTH_ERROR | 401 (token rejected) and 403 (the bot lacks permission in this channel). | | VALIDATION_ERROR | Unknown channel or deleted webhook (404), and malformed requests. | | CONTENT_REJECTED | An attachment or embed Discord refuses (400 with code 50035, 413). | | PLATFORM_ERROR | 5xx, retryable. |

Publishing is a single call, so there is no resume handle and no processing state.

A product note

Discord is an announcement channel, not a social network. There are no impressions, no reach and no post analytics behind a message. Label it accordingly in your UI, or users will expect numbers that do not exist.

Sources

License

MIT