Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
slack-webhook
Advanced tools
npm i -S slack-webhook
Setup an incoming webhook and copy the webhook url. This is the only required parameter to initialize the module.
var SlackWebhook = require('slack-webhook')
var slack = new SlackWebhook('https://hooks.slack.com/services/your/webhook/url')
Optionally, you can pass in a defaults
attribute to set defaults for the webhook's username
, icon_emoji
and channel
. If no defaults
attribute is used, it will default to the configuration that was used on the set up page.
var slack = new SlackWebhook('https://hooks.slack.com/services/your/webhook/url', {
defaults: {
username: 'Bot',
channel: '#general',
icon_emoji: ':robot_face:'
}
})
There are two ways to send a message. The first is by passing a string as the argument.
slack.send('some text')
The second is to pass a payload. Any options you pass in here will override the default ones you created at initialization.
slack.send({
text: 'some text',
attachments: [
// optional attachment data
],
username: 'new username',
icon_emoji: ':scream_cat:',
channel: '#another-channel'
})
Both versions return a promise.
slack.send('some text').then(function (res) {
// succesful request
}).catch(function (err) {
// handle request error
})
By default, this module uses Node >= v4's Promise
object, but you can configure it to use your preferred Promise
library.
// define it on initialization
var bluebird = require('bluebird')
var slack = new SlackWebhook('https://hooks.slack.com/services/your/webhook/url', {
Promise: bluebird
})
// define it after initialization
var q = require('q')
var slack = new SlackWebhook('https://hooks.slack.com/services/your/webhook/url')
slack.Promise = q.Promise
npm t
FAQs
Send messages to slack incoming webhook
The npm package slack-webhook receives a total of 5,105 weekly downloads. As such, slack-webhook popularity was classified as popular.
We found that slack-webhook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.