Skip to content
A Slack message "protocol droid®"
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
LICENSE
README.md
s-3po.gemspec

README.md

S-3PO

Gem Version security Code Climate Dependency Status

A protocol droid made by Cybot Galactica for Slack.

This gem parses, generates, and manupilates various Slack events and messages.

Requirements

  • Ruby 2.0.0 <=

Usage

If you're creating integrations or bots for Slack, this may come useful. Install:

$ gem install s-3po

Then use:

require 's-3po'

Your bot would connect to Slack via RTM API. Then process events like this.

event = S3PO.parse_event(data_from_slack, {botid: bot_id})
puts "#{event.type} : #{event.subtype}"
puts event.plain if event.is_simplemessage?
# => "@U123ABC: hello you!"

Generate a message to send to Slack.

json = S3PO.generate_message do |reply|
  reply.channel = 'CABC123'
  reply.plain = "@channel: what's up, ya all?"
end
puts json
# => {"type":"message","channel":"CABC123","text":"<!channel>: what's up, ya all?","id":0}

See YARD Doc for more info.

What's Next

  • Provide feedback
  • Expect more updates
  • Random anniversary on May 4th
You can’t perform that action at this time.