Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

slack-webhooks-handler

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slack-webhooks-handler

Manage incoming webhooks to send messages to Slack

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status

Slack Webhooks Handler

Manage incoming webhooks to send messages to Slack

Installation

# npm
npm install slack-webhooks-handler

# yarn
yarn add slack-webhooks-handler

Options

  • url(required): Your Slack custom integration (Incoming Webhook) URL
  • botName(optional): The name of the bot that will appear when sending messages. Do this if you want/need to override the one you set on your custom integration.
// options object
{
    url: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',
    botName: 'MyAPP-CI'
}

Usage

All you need to do is prepare a POST endpoint in your API that will be used when configuring the webhook in your preferred version control hosting (Github, Gitlab, Bitbucket, etc.)

At the moment you have the main dispatcher (Dispatcher) and a factory function.

You can use the dispatcher alone to send a simple message (just text) or a custom one following the attachments structure, or you can rely on the factory function (currently only supports Github's release and issues events, more on the way...)

const { Dispatcher, factory } = require('slack-webhooks-handler')

const dispatcher = new Dispatcher(options);
const hook = factory('github');
const { attachments } = hook(payload);

dispatcher.withAttachments(attachments);

(async () => {
    try {
        await dispatcher.send();
    }
    catch (error) {
        console.log(error);
    }
})();

For more info about event payloads take a look at:

Keywords

FAQs

Package last updated on 07 Nov 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc