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-app

v0.1.0

Published

Build a Slack App

Downloads

3

Readme

Slack App

Build your own Slack app. This module simplify the process of creating a Slack app by providing:

  • Send data into Slack with Incoming Webhooks:
  • Invoke actions outside of Slack with Commands
  • Build a bot user: connects in real time via websockets
  • Use Advanced APIs

Installation

npm install --save slack-app

Usage

// require the module
var SlackApp = require('slack-app');

// define the app
var sapp = new SlackApp({
    // webhooks express app
    express: {
        // pass your already existing express app instance to add the webhooks listeners
        // remember to call app.liste() only after calling the slackbotapp.start() method
        // (otherwise the listener might not be added)
        app: Object,
        // use if you want a new an express app be create to listen to webhooks on a specific port
        port: Number
    },
    // webhooks paths
    webhooks: {
        // register bot token hook, only if app is added with slack add button
        register: String,
        // execute command hook, only if using slack commands
        command: String
    },
    // bot credentials
    // needed to the register bot token weebook, only if app is added with slack add button
    credentials: {
        // bot client id
        client_id: String,
        // bot client secret
        client_secret: String
    },
    // tokens
    tokens: {
        // store the new register token, only if app is added with slack add button
        // avoids manualy re-adding the app to slack after a restart
        // (you might want to store it in a way that you can read it with the retrieve function)
        store: Function,
        // list of tokens to start the app with
        // can be a string
        // or an array of string
        // or a promise that will resolve with a string or an array of string
        // or a function that returns a string or an array of string,
        // or a function that accepts a callback that will be called passing a string or an array of string,
        // or a function that accepts return a promise that will resolve with a string or an array of string
        retrieve: String | Array | Function | Promise
    },
    // cron jobs
    jobs: [
        {
            // channel filter (execute job only on this channel)
            channel: String,
            // time schedule
            when: String,
            // message to send in the channel
            message: String,
            // job to execute
            exec: Function,
            // function executed after job stops
            end: Function,
            // timezone
            tz: String
        }
    ],
    analyzers: {
        // command handler
        command: Function,
        // message handler
        message: Function
    }
});

// start the app
sapp.start()

See example in /examples.