Coder Social home page Coder Social logo

slackreport's Introduction

SlackReport

A slack bot that adds the option to report a message to a private channel for review.

Setup

The setup of the Slack application, permissions and general approach is outlined at Getting started with Bolt.

The application does require a 'Request URL' to listen to events (e.g. when a message is reported). This is an external endpoint that Slack can send event notifications to, during local deveopment this can be achieved using 'ngrok' - see tunneling with ngrok.

Application Setup

Create a slack app

Image of App Setup

Action Setup

Visit 'Interactive Components' and add an action:

Image of Action Setup

Configuration

The app can be configured by either environment variables and/or a configuration file

export SLACKREPORT_SIGNING_SECRET=...
export SLACKREPORT_BOT_TOKEN=xoxb-...
export SLACKREPORT_REPORT_CHANNEL=reports
{
"SLACKREPORT_REPORT_MESSAGE_TEXT": "<@${body.user.id}> reported message '${payload.message.text}' from <@${payload.message.user}> in channel <#${payload.channel.id}>",
"SLACKREPORT_ACKNOWLEDGE_MESSAGE_TEXT": "The message was successfully reported, we will review the message and contact you if any further information is required."
}

Running

npm install
node app.js

Debugging

To aid debugging, the logLevel can be increased:

const app = new App({
  token: process.env.SLACKREPORT_BOT_TOKEN,
  signingSecret: process.env.SLACKREPORT_SIGNING_SECRET,
  logLevel: LogLevel.DEBUG
});

slackreport's People

Watchers

 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.