Gathering detailed insights and metrics for slack-notify
Gathering detailed insights and metrics for slack-notify
Gathering detailed insights and metrics for slack-notify
Gathering detailed insights and metrics for slack-notify
npm install slack-notify
98.4
Supply Chain
100
Quality
75.8
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
248 Stars
68 Commits
28 Forks
8 Watching
1 Branches
9 Contributors
Updated on 15 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-13.7%
11,226
Compared to previous day
Last week
-4%
68,426
Compared to previous week
Last month
11%
301,772
Compared to previous month
Last year
-14.2%
5,834,891
Compared to previous year
1
A simple, flexible, zero-dependency Node.js wrapper around the Slack webhook API. Makes it easy to send notifications to Slack from your application.
1npm install slack-notify
1 2// Import module: 3 4import SlackNotify from 'slack-notify'; 5const MY_SLACK_WEBHOOK_URL = 'https://hooks.slack.com/services/RANDOMCHARS'; 6const slack = SlackNotify(MY_SLACK_WEBHOOK_URL); 7 8// Example sending just text, using the Slack-provided configuration: 9 10slack.send('Hello!') 11 .then(() => { 12 console.log('done!'); 13 }).catch((err) => { 14 console.error(err); 15 }); 16 17// The Slack-provided configuration can be overridden: 18 19slack.send({ 20 channel: '#myCustomChannelName', 21 icon_url: 'http://example.com/my-icon.png', 22 text: 'Here is my notification', 23 unfurl_links: 1, 24 username: 'Jimmy' 25}); 26 27// Roll your own notification type: 28 29var statLog = slack.extend({ 30 channel: '#statistics', 31 icon_emoji: ':computer:', 32 username: 'Statistics' 33}); 34 35statLog({ 36 text: 'Current server statistics', 37 fields: { 38 'CPU usage': '7.51%', 39 'Memory usage': '254mb' 40 } 41}); 42 43// Promises are supported: 44 45slack.send('Hello!').then(() => { 46 console.log('Done!'); 47}).catch((err) => { 48 console.error('API error:', err); 49}) 50 51// Three pre-configured methods are provided: 52 53// Posts to #bugs by default: 54slack.bug('Something broke!'); 55 56// Posts to #alerts by default: 57slack.success('Something happened correctly!'); 58slack.alert('Something important!'); 59 60// Send custom fields which are nicely displayed by the Slack client: 61 62slack.alert({ 63 text: 'Current server stats', 64 fields: { 65 'CPU usage': '7.51%', 66 'Memory usage': '254mb' 67 } 68}); 69 70// The `fields` object is custom shorthand for the `attachments` array, which is also supported. 71 72slack.alert({ 73 text: 'Current server stats', 74 attachments: [ 75 { 76 fallback: 'Required Fallback String', 77 fields: [ 78 { title: 'CPU usage', value: '7.51%', short: true }, 79 { title: 'Memory usage', value: '254mb', short: true } 80 ] 81 } 82 ] 83}); 84 85// Set slack message color 86 87slack.alert({ 88 text: 'Current server stats', 89 attachments: [ 90 { 91 fallback: 'Required Fallback String', 92 color: '#FF0000', 93 fields: [ 94 { title: 'CPU usage', value: '90%', short: true }, 95 { title: 'Memory usage', value: '254mb', short: true } 96 ] 97 } 98 ] 99}); 100
1npm install 2npm test
This library supports CommonJS and ES Modules.
1// Require as Common JS: 2const SlackNotify = require('slack-notify'); 3 4// Import as ES Module: 5import SlackNotify from 'slack-notify'; 6 7// Either: 8const slack = SlackNotify(MY_SLACK_WEBHOOK_URL);
MIT. Copyright © 2014-2023 Andrew Childs
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 4/20 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More