Giter Club home page Giter Club logo

hubot-slack's Introduction

hubot-slack

Important Notice

The original hubot-slack is no longer under active development. Slack recommends taking a look at Bolt for JS with Socket Mode first if you're getting started.

But I'm going to maintain this fork as I continue to evolve Hubot. So feel free to use this one.

Installation

npm i @hubot-friends/hubot-slack hubot

This is a Hubot adapter to use with Slack.

Comprehensive documentation is available.

Adapter Configuration

  • Create (or use an existing one) a Slack Workspace
  • Create a Slack App
  • Create an App-Level Token and give it connections:write scope. This will be the HUBOT_SLACK_APP_TOKEN environment variable. The adapter will use this token to authenticate via Slacks Socket Mode (WebSockets)
  • Create a Bot Token. This will be the HUBOT_SLACK_BOT_TOKEN environment variable. The adapter will use this token to POST messages to Slack's HTTP API.
  • Make sure to give the Slack App the scope permissions noted below in "Notes on using SocketMode".

Startup

An example command to start the app on MacOS is the following. Assuming there is a file called .env with the following environment variables set:

HUBOT_SLACK_APP_TOKEN=xapp-1-...
HUBOT_SLACK_BOT_TOKEN=xoxb-...

Set the environment variables to the values you created for your Slack Apps App-Level Token (HUBOT_SLACK_APP_TOKEN) and Bot Token (HUBOT_SLACK_BOT_TOKEN).

env $(cat .env | grep -v \"#\" | xargs -0) PORT=8080 hubot -a @hubot-friends/hubot-slack -n mybot

Another way to start the app in MacOS or Linux is:

HUBOT_SLACK_APP_TOKEN=xapp-1... HUBOT_SLACK_BOT_TOKEN=xoxb-... PORT=8080 hubot -a @hubot-friends/hubot-slack -n mybot

Notes on using SocketMode

Need the following permissions:

  • app_mentions:read
  • channels:join
  • channels:history
  • channels:read
  • chat:write
  • im:write
  • im:history
  • im:read
  • users:read
  • groups:history
  • groups:write
  • groups:read
  • mpim:history
  • mpim:write
  • mpim:read

Need to following events:

  • app_mention
  • message.channels
  • message.im
  • message.groups
  • message.mpim

Sample YAML

The following YAML manifest will work.

display_information:
  name: NameOfYourBot
  description: Description of your bot.
  background_color: "#3d001d"
features:
  app_home:
    home_tab_enabled: false
    messages_tab_enabled: true
    messages_tab_read_only_enabled: false
  bot_user:
    display_name: NameOfYourbot
    always_online: true
oauth_config:
  scopes:
    bot:
      - app_mentions:read
      - channels:join
      - channels:history
      - channels:read
      - chat:write
      - im:write
      - im:history
      - im:read
      - users:read
      - groups:history
      - groups:write
      - groups:read
      - mpim:history
      - mpim:write
      - mpim:read
settings:
  event_subscriptions:
    bot_events:
      - app_mention
      - message.channels
      - message.im
      - message.groups
      - message.mpim
  interactivity:
    is_enabled: true
  org_deploy_enabled: false
  socket_mode_enabled: true
  token_rotation_enabled: false

hubot-slack's People

Contributors

aoberoi avatar grantmd avatar seratch avatar paulhammond avatar evansolomon avatar joeyguerra avatar leschekfm avatar mjsz avatar sionleroux avatar lilyball avatar mistydemeo avatar rtlechow avatar ysakasin avatar phucnh avatar technicalpickles avatar mbland avatar keescbakker avatar eibwen avatar eric avatar redhotvengeance avatar jeffreywescott avatar shaydewael avatar srajiang avatar roach avatar eriklindebratt avatar nanek avatar loisaidasam avatar tombell avatar stevengill avatar shadiakiki1986 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.