Skip to content

Latest commit

 

History

History
103 lines (84 loc) · 2.72 KB

README.md

File metadata and controls

103 lines (84 loc) · 2.72 KB

Table of Contents

About

Webhooks.js is a new, lightweight, and fast Node.js wrapper for the Discord Webhooks API.

  • Object Oriented
  • Up-to-Date

Installation

Node.js 12 or newer is required.

npm install webhooks.js --save

Examples

You can send a raw Webhook params object Read More

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

hook.send({
    username: "Webhook",
    content: "Hello!",
    embeds: [{
        title: "hello!"
    }]
})
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

or you can send a string

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

hook.send("hello world!")
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

or you can send a RichEmbed (different from Discord.js MessageEmbeds)

const hooks = require('webhooks.js')
const hook = new hooks.Webhook({ id: "your-webhook-id", token: "your-webhook-token" })

const embed = new hooks.RichEmbed()
.setTitle(`Embed test`)
.setTimestamp()
.setDescription("Test..?")

hook.send(embed)
.then(json => {
    console.log(json)
})
.catch(err => {
    console.error(err)
})

Links

Help

You can get help in the Webhooks.js Discord Server in the #support channel.