# node-mattermost

> Send and receive Mattermost Webhooks easily!

Latest version **0.0.1** (published 2015-11-19) · BSD license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-11-19 |
| First published | 2015-11-19 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 28 |
| Author | Jonathan Wiesel |
| Maintainers | jonathanwiesel |
| Keywords | mattermost, slack, webhook, integration |

## Links

- npm: https://www.npmjs.com/package/node-mattermost
- Repository: https://github.com/jonathanwiesel/node-mattermost
- Homepage: https://github.com/jonathanwiesel/node-mattermost#readme
- Issues: https://github.com/jonathanwiesel/node-mattermost/issues
- npm.io page: https://npm.io/package/node-mattermost

## 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.1 (latest) — 2015-11-19

## README

# node-mattermost

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

[Mattermost](http://www.mattermost.org/) is a messaging platform that is easy to integrate with.
This module should be useful for creating various integrations with Mattermost, such as
chat bots!

## Install Mattermost

node-mattermost is available via npm:

```
npm install node-mattermost
```


Get your hook_url from the Mattermost Incoming Webhooks Integration page.

```
var Mattermost = require('node-mattermost');
var mattermost = new Mattermost(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 mattermost = new Mattermost(hook_url,{proxy: http_proxy});
```

To send a message, call mattermost.send:

```
mattermost.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](https://github.com/mattermost/platform/blob/master/doc/integrations/webhooks/Incoming-Webhooks.md).


```
mattermost.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 mattermost, pass the information from the webhook into mattermost.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 = mattermost.respond(req.body,function(hook) {

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

	});

	res.json(reply);

});

```

### Notes

Based on [node-slack](https://github.com/xoxco/node-slack)

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