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

@glitch452/discord-webhook

v2.1.8

Published

Allows for easy webhook sending through discord's webhook API

Readme

Discord Webhook

NPM License NPM Version NPM Downloads

Table of Contents

What's New

Check out the GitHub Releases page for the latest release notes.

Install

npm install @glitch452/discord-webhook

Examples

Basic usage

import { MessageBuilder, Webhook } from '@glitch452/discord-webhook';

const hook = new Webhook('<YOUR_WEBHOOK_URL>');

hook.send('Hello there!');

Using the MessageBuilder to set other message parameters

import { MessageBuilder, Webhook } from '@glitch452/discord-webhook';

const message = new MessageBuilder('Hello there!')
  .setUsername('Bot Name')
  .setAvatarUrl('https://cdn.discordapp.com/embed/avatars/0.png');

const hook = new Webhook('<YOUR_WEBHOOK_URL>');

hook.send(message);

Adding a custom Embed to the message

import { EmbedBuilder, MessageBuilder, Webhook } from '@glitch452/discord-webhook';

const hook = new Webhook('<YOUR_WEBHOOK_URL>');

const embed = new EmbedBuilder()
  .setTitle('My title here')
  .setAuthor('Author here', 'https://cdn.discordapp.com/embed/avatars/0.png', 'https://www.google.com')
  .setUrl('https://www.google.com')
  .addField('First field', 'this is inline', true)
  .addField('Second field', 'this is not inline')
  .setColor('#00b0f4')
  .setThumbnail('https://cdn.discordapp.com/embed/avatars/0.png')
  .setDescription('Oh look a description :)')
  .setImage('https://cdn.discordapp.com/embed/avatars/0.png')
  .setFooter('Hey its a footer', 'https://cdn.discordapp.com/embed/avatars/0.png')
  .setTimestamp();

const message = new MessageBuilder().addEmbed(embed);

hook.send(message);

Keep in mind that the custom embed method setColor takes in a decimal color or a hex color (pure black and white hex colors will be inaccurate). You can convert hex colors to decimal using this website here: https://convertingcolors.com

Sending files

import { MessageBuilder, Webhook } from '@glitch452/discord-webhook';

const hook = new Webhook('<YOUR_WEBHOOK_URL>');

const message = new MessageBuilder().addFile('../yourFileName.png');

hook.send(message);

Preset messages

import { Webhook } from '@glitch452/discord-webhook';

const hook = new Webhook('<YOUR_WEBHOOK_URL>');

// Sends an information message
hook.info('**Information hook**', 'Information field title here', 'Information field value here');

// Sends a success message
hook.success('**Success hook**', 'Success field title here', 'Success field value here');

// Sends an warning message
hook.warning('**Warning hook**', 'Warning field title here', 'Warning field value here');

// Sends an error message
hook.error('**Error hook**', 'Error field title here', 'Error field value here');

Custom settings

import { Webhook } from '@glitch452/discord-webhook';

const hook = new Webhook({
  url: '<YOUR_WEBHOOK_URL>',
  // If throwErrors is set to false, no errors will be thrown if there is an error sending
  throwErrors: false,
  // retryOnLimit gives you the option to not attempt to send the message again if rate limited
  retryOnLimit: false,
});

License

The scripts and documentation in this project are released under the MIT License as defined by the Open Source Initiative.