$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
社内勉強会資料(2016/05/16)
Search
tom_furu
May 20, 2016
Technology
0
1.5k
社内勉強会資料(2016/05/16)
毎週やっている社内技術勉強会で使った資料です。
公開できない内容もあったので端折ったりマスクしたりしてます。
tom_furu
May 20, 2016
Tweet
Share
More Decks by tom_furu
See All by tom_furu
Collaboration Hack Meetup!! 登壇資料
tom_furu
0
1.1k
最新AWS活用事例LT大会!(ビール付き) 登壇資料 #loco_meetup_night
tom_furu
0
920
旅と技術のつながりを語る会 登壇資料 #travel_engineer
tom_furu
0
1.8k
IVS CTO NightのLTで使った資料 #ctonight
tom_furu
0
240
DevOps勉強会の発表で使った資料 #devops_LT
tom_furu
0
210
Slack x Hubot 勉強会の発表で使った資料 #hubot_LT
tom_furu
1
1.2k
【Loco Partners】Slack×hubotハッカソン0919
tom_furu
0
140
Other Decks in Technology
See All in Technology
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
320
Challenging Hardware Contests with Zephyr and Lessons Learned
iotengineer22
0
190
多様なデジタルアイデンティティを攻撃からどうやって守るのか / 20251212
ayokura
0
440
[CMU-DB-2025FALL] Apache Fluss - A Streaming Storage for Real-Time Lakehouse
jark
0
120
AWSセキュリティアップデートとAWSを育てる話
cmusudakeisuke
0
270
ガバメントクラウド利用システムのライフサイクルについて
techniczna
0
190
生成AIでテスト設計はどこまでできる? 「テスト粒度」を操るテーラリング術
shota_kusaba
0
740
MLflowダイエット大作戦
lycorptech_jp
PRO
1
110
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
AIと二人三脚で育てた、個人開発アプリグロース術
zozotech
PRO
1
720
Karate+Database RiderによるAPI自動テスト導入工数をCline+GitLab MCPを使って2割削減を目指す! / 20251206 Kazuki Takahashi
shift_evolve
PRO
1
740
ブロックテーマとこれからの WordPress サイト制作 / Toyama WordPress Meetup Vol.81
torounit
0
570
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Done Done
chrislema
186
16k
A better future with KSS
kneath
240
18k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
A Tale of Four Properties
chriscoyier
162
23k
Optimizing for Happiness
mojombo
379
70k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Documentation Writing (for coders)
carmenintech
76
5.2k
Transcript
FB Chatbot 2016/05/16 古田
FB Chatbot 作成 Facebook Messengerのbotを作りたい! (こちらはイメージです)
採用理由:運用面&コスト面で有利と判断 デプロイなど別管理にしたく relux本体のリポジトリとは切り離す。 このためだけにサーバを立てるのも勿体ないので Lambdaを利用。 RDSへ接続できるようになったし、せっかくだから Try。 構成 やりとり メッセージ
relux データ API gateway Lambda DynamoDB RDS
VPC AZ-a AZ-c インターネット ゲートウェイ Lambda用に サブネット作成 NAT ゲートウェイ
API gateway
Lambda(設定)
Lambda(FBからの認証) tokenを判別 var verify_token = 'XXXXXXXX'; exports.handler = function(event, context,
callback) { // Webhooks統合を有効にするための処理 if (event.verify_token === verify_token) { console.log('verify_token is correct'); callback(null, parseInt(event.challenge)); } callback(null, 'Error, wrong validation token'); };
Lambda(機能) function classifyMessageType(text) { // AAAですか? if (isAAAText(text)) { return
DATA_TYPE_AAA; } // BBBですか? if (isBBBText(text)) { return DATA_TYPE_BBB; } // CCCですか? if (isCCCText(text)) { return DATA_TYPE_CCC; } // DDDですか? if (isDDDText(text)) { return DATA_TYPE_DDD; } // それ以外ですね return DATA_TYPE_OTHER; } メッセージ種別判断 var aws = require('aws-sdk'); var dynamo = new aws.DynamoDB(); var tableName = "table-name"; function saveMessage(senderId, type, value) { var dynamoRequest = { "TableName" : tableName }; var nowTheTime = new Date(); var nowTheTimeStr = getTimeString(nowTheTime); dynamoRequest.Item = { "sender" : { "N" : String(senderId) }, "date" : { "S" : nowTheTimeStr }, "type" : { "S" : type }, "value" : { "S" : value } }; dynamo.putItem(dynamoRequest, function (err, data) {}); } メッセージ保存
Facebook設定
Facebook設定