Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kfatehi/slackihook
Send incoming webhooks to Slack
https://github.com/kfatehi/slackihook
Last synced: 3 months ago
JSON representation
Send incoming webhooks to Slack
- Host: GitHub
- URL: https://github.com/kfatehi/slackihook
- Owner: kfatehi
- License: isc
- Created: 2014-10-25T05:32:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-06-06T21:49:51.000Z (over 2 years ago)
- Last Synced: 2024-10-07T16:41:21.300Z (4 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM](https://nodei.co/npm/slackihook.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/slackihook/)
slackihook
==========Send incoming webhooks to Slack. That is all.
Code modified from https://github.com/xoxco/node-slack/blob/master/slack.js @ da918dc0935bf676ebeb15f7fe87b9c0b7a1fc1a
* take a webhookURL instead of domain & token, per Slack support
* use needle instead of request for the http request module
* remove http proxy options
* use only node-style callback (remove deferred and callback checks)
* passthru payload without tampering
* general code cleanup & readibility improvements
* remove #respond -- keep it simple and just #send# Install
`npm install slackihook`
# Usage
```javascript
var Slack = require('slackihook')var incomingWebhookURL = ""
slack = new Slack(incomingWebhookURL)
slack.send({
channel: "#general",
username: "TestBot",
icon_url: "/some/optional/url",
text: "here is my text"
}, function(err, res) {
// handle the node-style callback
})
```The payload is passed directly through to the POST request without tampering, so all Slack incoming webhook options are available to you.