Coder Social home page Coder Social logo

lita-slack's Introduction

lita-slack

Gem Version Build Status

lita-slack is an adapter for Lita that allows you to use the robot with Slack. The current adapter is not compatible with pre-1.0.0 versions, as it now uses Slack's Real Time Messaging API.

Installation

Add lita-slack to your Lita instance's Gemfile:

gem "lita-slack"

Configuration

Required attributes

Optional attributes

Note: When using lita-slack, the adapter will overwrite the bot's name and mention name with the values set on the server, so config.robot.name and config.robot.mention_name will have no effect.

config.robot.admins

Each Slack user has a unique ID that never changes even if their real name or username changes. To populate the config.robot.admins attribute, you'll need to use these IDs for each user you want to mark as an administrator. If you're using Lita version 4.1 or greater, you can get a user's ID by sending Lita the command users find NICKNAME_OF_USER.

Example

Lita.configure do |config|
  config.robot.adapter = :slack
  config.robot.admins = ["U012A3BCD"]
  config.adapters.slack.token = "abcd-1234567890-hWYd21AmMH2UHAkx29vb5c1Y"
  config.adapters.slack.parse = "full" # See https://api.slack.com/docs/formatting#parsing_modes
end

Joining rooms

Lita will join your default channel after initial setup. To have it join additional channels or private groups, simply invite it to them via your Slack client as you would any normal user.

Events

  • :connected - When the robot has connected to Slack. No payload.
  • :disconnected - When the robot has disconnected from Slack. No payload.
  • :slack_user_created - When the robot creates/updates a user's info - name, mention name, etc., as directed by Slack. The payload has a single object, a Lita::Slack::Adapters::SlackUser object, under the :slack_user key.
  • :slack_channel_created - When the robot creates/updates a channel's or group's info, as directed by Slack. The payload has a single object, a Lita::Slack::Adapters::SlackChannel object, under the :slack_channel key.

Chat service API

lita-slack supports Lita 4.6's chat service API for Slack-specific functionality. You can access this API object by calling the Lita::Robot#chat_service. See the API docs for Lita::Adapters::Slack::ChatService for details about the provided methods.

API documentation

The API documentation, useful for plugin authors, can be found for the latest gem release on RubyDoc.info

License

MIT

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.