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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kirill Shevchenko
May 19, 2018
Programming
270
4
Share
[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.6k
Other Decks in Programming
See All in Programming
AI活用のコスパを最大化する方法
ochtum
0
380
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
990
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
250
Java 21/25 Virtual Threads 소개
debop
0
340
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
220
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
150
アーキテクチャモダナイゼーションとは何か
nwiizo
17
4.7k
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
620
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
290
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
6.1k
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
140
Featured
See All Featured
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
480
Designing Powerful Visuals for Engaging Learning
tmiket
1
330
Art, The Web, and Tiny UX
lynnandtonic
304
21k
30 Presentation Tips
portentint
PRO
1
270
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
180
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1k
Being A Developer After 40
akosma
91
590k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
180
How to train your dragon (web standard)
notwaldorf
97
6.6k
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