Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[Ruby Meditation #22] Building Slack Apps with ...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kirill Shevchenko
May 19, 2018
Programming
280
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[Ruby Meditation #22] Building Slack Apps with Ruby
Kirill Shevchenko
May 19, 2018
More Decks by Kirill Shevchenko
See All by Kirill Shevchenko
[RubyWine #1] Event-Driven Architecture and Messaging Patterns for Ruby Microservices
kirillshevch
1
7.7k
Other Decks in Programming
See All in Programming
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
160
AIで効率化できた業務・日常
ochtum
0
130
Inside Stream API
skrb
1
690
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
220
New "Type" system on PicoRuby
pocke
1
840
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
100
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
260
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2k
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
390
TAKTでAI駆動開発の品質を設計する
j5ik2o
6
1.2k
Agentic UI
manfredsteyer
PRO
0
150
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
200
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
The browser strikes back
jonoalderson
0
1.2k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Transcript
Building Slack Building Slack Apps with Apps with Ruby Ruby
Integrations Overview Integrations Overview Slash Commands Custom Integrations Bot Users
Incoming Webhooks
Incoming webhooks Incoming webhooks A way to send messages to
Slack https://slack.com/apps/A0F7XDUAZ-incoming-webhooks
Incoming webhooks Incoming webhooks require 'slack/incoming/webhooks' slack = Slack::Incoming::Webhooks.new( 'WEBHOOK_URL'
) slack.post 'Useful information' https://github.com/shoyan/slack-incoming-webhooks
Example Example
Slash commands Slash commands A way to add /slash commands
Creating a new Slack App Command request authorization Command validation and response
Creating a Slack App Creating a Slack App https://api.slack.com/apps
Response Permission Response Permission
Adding a command Adding a command
Local HTTPS-Proxy Local HTTPS-Proxy ./ngrok http 9292
Response Sample Response Sample require 'sinatra' post '/' do 'OK'
end
None
Legacy custom integrations Legacy custom integrations Custom integrations Custom integrations
https://api.slack.com/custom-integrations/legacy-tokens
Bot users Bot users
Authentication Authentication
{ "access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX", "scope": "commands,bot", "team_name": "Team Installing Your Bot",
"team_id": "XXXXXXXXXX", "bot":{ "bot_user_id":"UTTTTTTTTTTR", "bot_access_token":"xoxb-XXXXXXXXXXXX-TTTTTTTTTTTTTT" } } Response Response
Tools Tools https://github.com/slack-ruby (not affiliated with Slack) slack-ruby-bot slack-ruby-bot Provides
DSL for building text commands. slack-ruby-client slack-ruby-client A Ruby and command-line client for the Slack Web and Real Time Messaging APIs.
slack-ruby-bot slack-ruby-bot require 'slack-ruby-bot' class PongBot < SlackRubyBot::Bot command 'ping'
do |client, data, match| client.say(text: 'pong', channel: data.channel) end end PongBot.run A Minimal Bot SLACK_API_TOKEN=... bundle exec ruby pongbot.rb
Slack Web API Slack Web API The Web API is
a collection of , all with URLs in the form: HTTP RPC-style methods https://slack.com/api/FAMILY_METHOD.method
slack-ruby-client slack-ruby-client client = Slack::Web::Client.new( token: 'SLACK_BOT_TOKEN' ) client.chat_postMessage( channel:
'#general', text: 'Hello World' ) https://api.slack.com/methods/chat.postMessage
Web API rate limit Web API rate limit https://api.slack.com/methods/chat.update
Interactive messages Interactive messages https://api.slack.com/interactive-messages
Message Formatting Message Formatting https://api.slack.com/docs/messages/builder
Walkie Bot Walkie Bot Prototyping Tool for Slack Bots https://github.com/FoundersAS/walkiebot
None
Slack RTM Slack RTM The Real Time Messaging API is
a WebSocket-based API that allows you to receive from Slack in real time. events
rtm.connect rtm.connect Workspace https://api.slack.com/methods/rtm.connect wss://slack-msgs.com/websocket/uid These URLs are only valid
for 30 seconds, so connect quickly!
client = Slack::RealTime::Client.new( token: 'SLACK_BOT_TOKEN' ) client.on :message do |data|
client.message( channel: data.channel, text: "Hi <@#{data.user}>!" ) end client.start!
Ruby Websocket Clients Ruby Websocket Clients Faye::Websocket websocket-client-simple
Multiple connections Multiple connections Workspace 1 Workspace 2 Workspace N
wss://slack-msgs.com/websocket/uid wss://slack-msgs.com/websocket/uid wss://slack-msgs.com/websocket/uid
Concurrent Processing Concurrent Processing eventmachine celluloid concurrent-ruby
slack-ruby-client slack-ruby-client Slack::RealTime.configure do |config| config.concurrency = Slack::RealTime::Concurrency::Celluloid # config.concurrency
= Slack::RealTime::Concurrency::Eventmachine end
None
Alternatives Alternatives https://github.com/slackapi/node-slack-sdk https://github.com/BlakeWilliams/Elixir-Slack
None
Testing? Testing?
API Updates API Updates https://slack.com/apps/A0F81R7U7-rss
Community Community https://community.botkit.ai
Thanks! Thanks! kirillshevch kirillshevch @kirill_shevch @kirill_shevch @kirill_shevch @kirill_shevch