Coder Social home page Coder Social logo

mozaik-ext-slack's Introduction

mozaik-ext-slack

Module provides some Slack widgets for Mozaïk dashboard.

preview-channel

Setup

Follow the steps to install and configure widget into dashboard

Dependencies

  • Install module in dashboard directory:

    npm install -S mozaik-ext-slack
  • Register client api by adding to dashboard src/server.js:

    // NOTE: Widget uses push method to delivery messages!
    import slack from 'mozaik-ext-slack/client';
    mozaik.bus.registerApi('slack', slack, 'push');
  • Register widgets by adding to dashboard src/App.jsx:

    import slack from 'mozaik-ext-slack';
    mozaik.addBatch('slack', slack);
  • Build the dashboard:

    npm run build-assets

Slack

SLACK_TOKEN=value-provided-by-slack

Widgets

Set api and widget configuration values in dashboard config.js. See followup sections for details.

module.exports = {
  // Configure api
  api: {
    slack: {
      // Slack api token
      // $SLACK_TOKEN
      token: 'valuefromslack',

      // NOTE: Following config parameters are OPTIONAL!
      // Download the uploaded images and show them in dashboard
      // $SLACK_SHOW_IMAGES
      showImages: true,
      // Directory where the static files are hosted from. Needed for images. Defaults to cwd() + './build'
      publicDir: '/path/to/mozai-demo/build',
      // The age of temp images to delete
      // $SLACK_MAX_IMAGE_AGE
      maxImageAge: '8 hours',
  },

  // Set widgets
  dashboards: [
    columns: 2,
    rows: 2,
    // See next sections for details
    widgets: [
      {
        type: 'slack.channel',
        channel: 'general',
        columns: 1, rows: 1,
        x: 0, y: 0
      },
      {
        type: 'slack.pulse',
        columns: 1, rows: 1,
        x: 1, y: 0
      },
    ]
  ]
}

Finally, start the dashboard with command:

node app.js

Widget: slack.channel

Show pulsating circle for each message sent in Slack channel(s)

preview-channel

preview-channel

parameters

key required description
title no Textual title to show. Example: '#mychannel'.
channel no Name of the channel to follow. Defaults to all public channels where token has permissions to
imageSize no Scaling of image: initial, cover, contain. Default to initial
config no Override default pulse config parameters or colors. See source code for details

usage

{
  type: 'slack.pulse',
  channel: 'general',
  columns: 2, rows: 1,
  x: 1, y: 0
}

Widget: slack.pulse

Show pulsating circle from each message sent in Slack channel(s)

preview-pulse

parameters

key required description
channel no Name of the channel to follow. Defaults to all public channels where token has permissions to
title no Textual title to show. Example: '#mychannel'.

usage

{
  type: 'slack.pulse',
  channel: 'general',
  columns: 2, rows: 1,
  x: 1, y: 0
}

License

Distributed under the MIT license

Changelog

Release 0.4.0

  • Added support for pulse configuration
  • Multiple ripples per message

Release 0.3.1

  • Improved error cases and logging

Release 0.3.0

  • Added support for showing images
  • Added support for showing emojis
  • Added duration info since previous message
  • Improved message formatting

Release 0.2.0

  • Added since time information
  • Fixed issue when having multiple pulse widgets
  • Improved style

Release 0.1.0

  • Initial somewhat working version

mozaik-ext-slack's People

Contributors

juhamust avatar

Watchers

James Cloos avatar Tomasz Wojtuń avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.