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

slackflow

v1.0.1

Published

A Slack bot powered through flowlytics that brings your Dialogflow analytics data into Slack

Downloads

2

Readme

SlackFlow

DialogFlow Analytics + Slack bot

Purpose

To make it incredibly simple to have a slack bot grab your Dialogflow's analytics data and give you a daily update on how it's performing

How it's built

We created and used Flowlytics library to wrap the Dialogflow Analytics API so all you need to do is provide your headers and slack tokens

Installation

Run in your terminal

npm install --save slackflow

Grabbing Your Dialogflow Tokens

  1. To see how to grab your tokens for Dialogflow, see the guide at Flowlytics

Grabbing Your Slack Tokens

  1. To grab your Slack tokens, you have a couple options depending on if you want to post into a DM or a public or private slack channel.
  2. First create your Slack App by clicking the button in the top right to create screenshot your slack app overview page for your apps
  3. Fill out your app's name and the Slack workspace you'd like to use it in Basic info modal for the app name and workspace your app will be in
  4. You'll have to approve the slack workspace you're adding it to and then choose the user or channel you'd like it to post to Modal to choose which channel or user you'd like your bot to send messages to
  5. For now, this slack app is only a webhook but if someone wants to add slash commands or events that would be awesome Basic information for building apps for slack, and we'll be choosing the first card which is for incoming webhooks
  6. Turn on the webhook and grab your webhook URL Webhook URL has been generated
  7. Copy that webhook URL and drop it into the config file, analytics Grabbing URL through the copy button

Usage

To configure the library, drop your slack webhook URL's and your tokens from flowlytics down below.

The one thing to note is the channelsInterval which is where you configure the places the slack bot will post to, as well as the number of days of data of Dialogflow data you'll be grabbing to post into slack

analytics.js

// Array of days and slack channel URLs to post into
const channelsInterval = [
    {
        channelUrl: "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK_URL",
        day: 1
    },
    {
        channelUrl: "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK_URL",
        day: 7
    },
    {
        channelUrl: "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK_URL",
        day: 30
    },
    //etc
];

// Tokens for grabbing Dialogflow Analytics data
const tokens = {
    "xsrf": "YOUR_XSRF_TOKEN",
    "user_agent": "YOUR_USER_AGENT",
    "cookie": "YOUR_COOKIE_HERE",
    // Make sure this starts with 'Bearer'
    "auth": "YOUR_AUTH_TOKEN",
};

require( "slackflow" )( channelsInterval, "YOUR_APP_NAME", tokens );

Crontab

If you want to run this script on a schedule, say every morning at 8am, you'll want to use crontab to execute the analytics.js file

crontab -e

Example of running the script everyday at 7am

* 7 * * * node /var/www/html/scripts/slackflow/analytics.js

Contributors

Built by Josh Benner @ HackIllinois2018. Feel free to make suggestions and pull requests to improve the project.

License

This project is licensed under the terms of the MIT license.