# node-slack

> Send and receive Slack Webhooks easily!

Latest version **0.0.7** (published 2015-05-11) · BSD license · 0 weekly downloads

## Install

```sh
npm install node-slack
pnpm add node-slack
yarn add node-slack
bun add node-slack
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2015-05-11 |
| First published | 2013-09-14 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | separate (@types/node-slack) |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 384 |
| Author | Ben Brown |
| Maintainers | xoxco |

## Links

- npm: https://www.npmjs.com/package/node-slack
- Repository: git@github.com:xoxco/node-slack
- Homepage: https://github.com/xoxco/node-slack
- Issues: https://github.com/xoxco/node-slack/issues
- npm.io page: https://npm.io/package/node-slack

## Dependencies (2)

- [request](https://npm.io/package/request.md) ~2.x
- [deferred](https://npm.io/package/deferred.md) 0.7.1

## Recent versions

- 0.0.7 (latest) — 2015-05-11
- 0.0.6 — 2015-05-11
- 0.0.5 — 2014-10-02
- 0.0.4 — 2014-07-04
- 0.0.3 — 2013-09-14
- 0.0.2 — 2013-09-14
- 0.0.1 — 2013-09-14

## README

# node-slack

A node module for sending and receiving messages with Slack via webhooks.

[Slack](https://slack.com/) is a messaging platform that is easy to integrate with.
This module should be useful for creating various integrations with Slack, such as
chat bots!

## Install Slack

node-slack is available via npm:

```
npm install node-slack
```


Get your hook_url from the Slack Incoming Webhooks Integration page.

```
var Slack = require('node-slack');
var slack = new Slack(hook_url,options);
```

If your system requires that requests be made through
an HTTP or HTTPS proxy, you can either set an environment
variables https_proxy and http_proxy,
or pass in the optional third option:

```
var slack = new Slack(hook_url,{proxy: http_proxy});
```

To send a message, call slack.send:

```
slack.send({
	text: 'Howdy!',
	channel: '#foo',
	username: 'Bot'
});
```

You can also specify an emoji icon, a url to a custom icon, attachments,
and any of the other options listed [here](slack.com/services/new/incoming-webhook).


```
slack.send({
	text: 'Howdy!',
	channel: '#foo',
	username: 'Bot',
	icon_emoji: 'taco',
	attachments: attachment_array,
	unfurl_links: true,
	link_names: 1
});
```



To respond to an [outgoing webhook from slack](https://slack.com/services/new/outgoing-webhook), pass the information from the webhook into slack.respond,
along with a callback function responsible for returning a response.

From inside an Express.js route, this is as easy as passing in req.body:

```
app.post('/yesman',function(req,res) {

	var reply = slack.respond(req.body,function(hook) {

		return {
			text: 'Good point, ' + hook.user_name,
			username: 'Bot'
		};

	});

	res.json(reply);

});

```

---
_Source: https://npm.io/package/node-slack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
