GithubHelp home page GithubHelp logo

rlugojr / node-slackhook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joezo/node-slackhook

0.0 3.0 0.0 8 KB

The only module you'll need for custom hooks that integrate with Slack

License: MIT License

JavaScript 100.00%

node-slackhook's Introduction

Slackhook

The only module you'll need for custom hooks that integrate with Slack.

Build Status

Installation

npm install slackhook

Requirements

You'll need a domain and token from Slack.

The domain will be the organisation part of <organisation>.slack.com

The token is given to you when you create your incoming webhook integration.

Usage

var Slackhook = require('slackhook');
var slack = new Slackhook({
    domain: 'yourdomain',
    token: 'yourtoken'
});

Sending

You can set up incoming webhooks here

slack.send({
    content: 'Hi everybody',
    channel: '#general',
    username: 'Dr. Nick',
    icon_url: 'drnick.png' 
});

You can pass the send method a callback if you like.

slack.send({
    text: 'Hi Dr. Nick!',
    channel: '#general',
    username: 'Everybody',
    icon_emoji: 'smile'
}, function(err, response){
    // Do your thing
});

Responding

You can also respond to webhooks coming from Slack. You could use this to make a chat bot etc.

You can set up outgoing webhooks here

This example assumes you're running inside an Express.js route.

app.post('/outgoing', function(req, res){
	var hook = slack.respond(req.body);
	res.json({text: 'Hi ' + hook.user_name, username: 'Dr. Nick'});
});

Example apps

Teamcity integration

License

MIT

node-slackhook's People

Contributors

saitheexplorer avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.