lighthouse-score-for-slack

0.2.1 • Public • Published

Slack Bot to publish Google Lighthouse performances KPI

Build Status Coverage Status

The idea behind this project is to produce a NODEJS module to publish a card on a Slack Chat. Example:

Slack Attachment

A valid example of usage is here: https://github.com/marco-genova-ntt/lighthouse-ci

Technological Stack

  • NodeJS 8+
  • Babel 7
  • Jest
  • Dotenv

The project is ES6-based.

##Integration with Slack (0.2+) The application use two methods:

  1. Incoming Webhooks (default)
  2. Bots configuration

see environment variable: SLACK_MODE

Integration with Slack (below 0.2)

In order to enable the integration with slack channel, a Slack Apps was created to create. Actually it's not published. The name of the slack app is "LightHouse Score Publisher".

NOTE: In order to publish in a channel it's important to retrive an OAUTH token from slack you can create a non redistribuable application and use the bot token:

Slack Bot OAUTH Token

How to define .env in the project

The following properties can be added to an existent .env file:

#Slack token for the slack client, An access token (from your Slack app or custom integration - xoxp, xoxb)
SLACK_TOKEN=xoxb-.....,

#Slack channel identifier, use Web API simulator to extract this value (https://api.slack.com/methods/conversations.list)
SLACK_CHANNEL_ID=C6H41XTRU

#SLACK MODE TYPE (WEB (web book) or BOT)
SLACK_MODE=WEB

#Base api url, use this for the actual version of api (SLACK_MODE=BOT)
SLACK_BASE_API=https://slack.com/api/{method}?token={token}&pretty=1

#URl Incoming WEB HOOK (SLACK_MODE=WEB)
SLACK_WEB_HOOK=https://hooks.slack.com/services/THXcd3CRG/BJ03reFY/Ia72bin7j6wer23VSvSXLvTQw

References

  1. https://nttdataclickcollect.slack.com/apps
  2. https://api.slack.com/custom-integrations/web

Package Sidebar

Install

npm i lighthouse-score-for-slack

Weekly Downloads

2

Version

0.2.1

License

MIT

Unpacked Size

108 kB

Total Files

30

Last publish

Collaborators

  • marco.genova.ntt