Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 824 Bytes

File metadata and controls

40 lines (26 loc) · 824 Bytes

BOT API Basics

Slack-ruby-bot makes it all very easy.

Make a Team

Sign up at slack.com, my team is dblockdotorg.slack.com.

Create a New Bot Integration

This is something done in Slack, under integrations. Create a new bot, and note its API token.

Gemfile

source 'http://rubygems.org'

gem 'slack-ruby-bot'

Say Hi

require 'slack-ruby-bot'

module HiBot
  class App < SlackRubyBot::App
  end

  class Hi < SlackRubyBot::Commands::Base
    command 'hi' do |client, data, _match|
      client.message text: "hi <@#{data.user}>", channel: data.channel
    end
  end
end

HiBot::App.instance.run