A protocol droid made by Cybot Galactica for Slack.
This gem parses, generates, and manupilates various Slack events and messages.
- Ruby 2.0.0 <=
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.
- Provide feedback
- Expect more updates
- Random anniversary on May 4th