npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slack-texts

v0.2.5

Published

Receive text alerts for Slack messages

Downloads

1

Readme

slack-texts

NPM version License shield

Receive text messages for conversations on Slack channels using Twilio.

You can import it as a package (see below), or use it directly from the command-line.

Quick start

Install via npm:

$ npm install --save slack-texts

Import the package and specify keys:

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:

$ 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.

  2. options:

    Configuration for the slack_texts instance. The default values are shown below.

    {
        // 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 for new features and bug fixes.

License

The MIT License. Please see the LICENSE file at the root of this repository.