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
Firebase + BoltではじめるSlackアプリ開発
Search
mako_makok
November 21, 2020
Technology
0
15k
Firebase + BoltではじめるSlackアプリ開発
この資料は2020/11/18に行われた、「自動化大好きエンジニアLT会」の発表資料です。
https://rakus.connpass.com/event/192101/
mako_makok
November 21, 2020
Tweet
Share
More Decks by mako_makok
See All by mako_makok
Kotlinにおける型の世界と エラーハンドリング / Type World and Error Handling in Kotlin
makomakok
3
1.2k
Javaでも使えるKotlin OSSを目指すためのkotlin.jvmの利用とインターフェース設計/Use of kotlin.jvm and interface design for Kotlin OSS that can also be used in Java
makomakok
0
920
Slack_API_Wrapper_BoltでBotを爆速開発.pdf
makomakok
0
350
退屈なことはバッチにやらせよう
makomakok
1
630
Other Decks in Technology
See All in Technology
組織のSREを推進するためのPlatform EngineeringとEKS / Platform Engineering and EKS to drive SRE in your organization
chmikata
0
180
primeNumber DATA MANAGEMENT CAMP #2:
masatoshi0205
1
670
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
71k
AIエンジニア Devin と歩む、自律型運用プロセスの構築
a2ito
0
610
競争優位を生み出す戦略的内製開発の実践技法
masuda220
PRO
2
530
脱・コピペ!自分で調べて書くK8sマニフェスト
devops_vtj
0
110
AIエージェントで変わる開発プロセス ― レビューボトルネックからの脱却
lycorptech_jp
PRO
2
850
トラブルの大半は「言ってない」x「言ってない」じゃねーか!!
ichimichi
0
300
Snowflake Night #2 LT
taromatsui_cccmkhd
0
320
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
200
全自動で回せ!Claude Codeマーケットプレイス運用術
yukyu30
3
160
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
310
The SEO identity crisis: Don't let AI make you average
varn
0
400
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
0
2.4k
Git: the NoSQL Database
bkeepers
PRO
432
66k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Navigating Weather and Climate Data
rabernat
0
130
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Transcript
Firebase + Boltで始める 自動化のススメ @mako_makok 2020/11/18 自動化大好きエンジニア LT会
自己紹介 • 名前: 小林允(@mako_makok) • 所属: 株式会社ラクス • メインはバックエンドエンジニア •
フロントエンドもかじってる • Spring/Java/Kotlin/TypeScript/React
勉強会の情報を毎日通知してくれるSlackアプリを 作った
None
使ったもの • Cloud Functions(Firebase) • Firebase FireStore • Bolt For
JavaScript
Cloud Functions For Firebase • イベントをトリガーにしてバックエンドのコードを実行 • 200万/月 イベントまで無料 •
有料プラン(Blaze)じゃないと使えない
Firestore • NoSQL データベース • 無料プラン(Spark)でも使える • 容量: 1GB •
Read: 50000/日 • Write, Delete: それぞれ20000/日
正直botレベルでこんなに使わないので実質無料
Bolt For JavaScript • Slackアプリ構築用のフレームワーク • Slack API Team謹製 •
Slack API Client + Receiver + 便利な型定義 • TypeScriptで書かれている • For JavaScriptとあるだけあり多言語のSDKも提供されている ◦ Python, Java
Firestore slash command でモーダル 表示をRequest Functions モーダルを返却
Firestore slash command でモーダル 表示をRequest モーダルを生成 Formを送信 Formの内容を登録 Functions
Firestore slash command でモーダル 表示をRequest モーダルを返却 Formを送信 Formの内容を登録 Functions 1.
ユーザごとのパラ メータを取得 2. APIを叩く 3. webhookでそれぞれ のユーザにDM送信
なぜFirebase? • 他のmBaaSだとAWS Amplifyがある ◦ ちょっと前までAmplifyにはemulatorがなかった ▪ 今はAmplifyにもlocal emulatorがある ◦
AmplifyだとAppSyncがある ▪ Slack bot開発では特に使う必要がない • 個人的にFirebaseのほうが慣れている
Boltの利点 • slackアプリ作成に必要なものが全部入ってくる ◦ Receiver(express)も内包されているので別途インストールの必要 なし • 便利な関数 ◦ ack()
◦ say() ◦ etc... export const expressReceiver = new ExpressReceiver ({ signingSecret: config.slack.secret, endpoints: '/events', processBeforeResponse: true }) export const app = new App({ receiver: expressReceiver , token: config.slack.token, processBeforeResponse: true })
Bolt for JavaScriptの利点 • Slackアプリのviewを作成するBlock Kitという仕組みがある ◦ section一個につきプロパティ5~10個程度書くので物量がある • 便利な型定義
◦ Blockの型定義 ◦ 他にもSlackは色々できる分Payloadが長くなりがち ◦ 型定義のおかげで補完を効かせながら書ける
None
FaaSでBolt利用時の注意点 export const expressReceiver = new ExpressReceiver({ signingSecret: config.slack.secret, endpoints:
'/events', processBeforeResponse: true }) これをつけ忘れない!
まとめ • Firebaseでは安く簡単で早くアプリ開発ができる • Boltを使うことでSlackアプリ開発に集中できる • processBeforeResponseは絶対に忘れないようにしましょう(戒め)