# slack-texts

> Receive text alerts for Slack messages

Latest version **0.2.5** (published 2017-01-09) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2017-01-09 |
| First published | 2015-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Nishanth Shanmugham |
| Maintainers | nishanths |
| Keywords | slack, text, sms, twilio |

## Links

- npm: https://www.npmjs.com/package/slack-texts
- Repository: https://github.com/nishanths/slack-texts
- Issues: https://github.com/nishanths/slack-texts/issues
- npm.io page: https://npm.io/package/slack-texts

## Dependencies (4)

- [ws](https://npm.io/package/ws.md) ^0.7.2
- [twilio](https://npm.io/package/twilio.md) ^2.2.0
- [request](https://npm.io/package/request.md) ^2.55.0
- [querystring](https://npm.io/package/querystring.md) ^0.2.0

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 0.2.5 (latest) — 2017-01-09
- 0.2.4 — 2017-01-05
- 0.2.3 — 2015-05-23
- 0.2.2 — 2015-05-23
- 0.2.1 — 2015-05-23
- 0.2.0 — 2015-05-23
- 0.1.3 — 2015-05-22
- 0.1.2 — 2015-05-22
- 0.1.1 — 2015-05-22
- 0.1.0 — 2015-05-22

## README

# [slack-texts](https://github.com/nishanths/slack-texts) 

[![NPM version](https://img.shields.io/npm/v/slack-texts.svg)](https://www.npmjs.com/package/slack-texts) [![License shield](https://img.shields.io/npm/l/slack-texts.svg)](https://github.com/nishanths/slack-texts/blob/master/LICENSE)

Receive text messages for conversations on [Slack](http://slack.com)
channels using Twilio.

You can import it as a package (see below), or use it directly from the [command-line](https://github.com/nishanths/slack-texts/blob/master/cmd/slack-texts).

## Quick start

Install via npm:

```sh
$ npm install --save slack-texts
```

Import the package and specify keys:

```js
var slack_texts = require('slack-texts');

var keys = {
    slack: {
        token: '<slack-token>'
    },
    twilio: {
        sid:   '<twilio-sid>',
        token: '<twilio-token>',
        phone: '<twilio-phone>'
    }
};

var options = {
    team_name:                'go-team',
    ignore_case_keywords:     true,
    keywords:                 ['economy', 'responsive'],
    channel_names_to_monitor: ['announcements', 'development'],
    send_to_contacts:         [
        { phone: '+10000000000' },
        { phone: '+19999999999' },
        { phone: '+15555555555' }
    ]
};

var st = slack_texts.init(keys, options);
st.start(); // Async call.

// Do other stuff here, if necessary.
```

Run: 

```sh
$ node app.js
``` 

## Features

* Specify phone numbers to send messages to
* Monitor a specific list (or all) channels
* Use only messages that contain specified keywords

## Documentation

#### init()

Initializes and returns a new slack_texts instance. It the same as calling
`new slack_texts(..)`. 

```
var slack_texts = require('slack-texts');
var st = slack_texts.init(keys, options);
```

The two arguments are:

1. keys:

	Twilio and Slack API keys, as shown in the Quick start section. 
	All fields are required.

1. options: 

	Configuration for the `slack_texts` instance.
	The default values are shown below.
	
	```js
	{
	    // The team name to display in text messages.
	    // Type: string.
	    team_name:                '',
	
	    // Whether to ignore case when filtering messages by keyword.
	    // Type: boolean.
	    ignore_case_keywords:     true,
	
	    // Keywords to filter messages by. If a messages contains any
	    // of the keywords, it will be used for text notifications.
	    // To disable keyword filtering, leave the property undefined
	    // or use an empty array.
	    //
	    // Type: Array<string>.
	    keywords:                 [],
	
	    // The channels to listen to. If a message is sent to these channels,
	    // it will be used for text notifications (subject to other
	    // configuration). To listen to all channels, leave the property
	    // undefined or use an empty array.
	    //
	    // Type: Array<string>.
	    channel_names_to_monitor: [],
	
	    // List of objects, each object containing a phone field (string).
	    // Text messages will be sent to these phones.
	    // 
	    // Type: Array<Object>
	    send_to_contacts:         []
	}
	```

#### start()

Listens for new messages asynchronously, and dispatches text messages
depending on the provided options. The method takes no arguments.

```
var slack_texts = require('slack-texts');
var st = slack_texts.init(keys, options);
st.start();
```

## Contributing

Pull requests are welcome.

1. Fork the repository
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create new Pull Request

You can also create an [issue](https://github.com/nishanths/slack-texts/issues) for new features and bug fixes.

## License

The MIT License. Please see the [LICENSE](https://github.com/nishanths/slack-texts/blob/master/LICENSE) file at the root of this repository.

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