Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
社内勉強会資料(2016/05/16)
Search
tom_furu
May 20, 2016
Technology
1.5k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内勉強会資料(2016/05/16)
毎週やっている社内技術勉強会で使った資料です。
公開できない内容もあったので端折ったりマスクしたりしてます。
tom_furu
May 20, 2016
Transcript
10 slides
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設定
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
930
旅と技術のつながりを語る会 登壇資料 #travel_engineer
tom_furu
0
1.8k
IVS CTO NightのLTで使った資料 #ctonight
tom_furu
0
250
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
160
Other Decks in Technology
See All in Technology
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
640
RAGの改善を速く回すための評価基盤
yosukeyoshida
6
3.3k
AWS Blocksで AIエージェント作れるの知ってます?
kmiya84377
1
110
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
430
メール到達性を支える、リンク先URLのドメイン評価の扱い方
wind111
0
170
OCI Artifact による自動運転タクシーに向けた OTA 基盤の構築
biwashi
1
160
速くなるほど、深く考える AI時代のQAに学ぶ
kobayashiyorimitsu
0
270
Kansai WordPress Meetup@大阪『ブロックテーマを作る上で知っておくべきこと
torounit
0
250
WasmをRustにする技術
sansantech
PRO
1
130
gradle-best-practices 使ってみた
mikanichinose
0
180
AI対話型分析を作成し、リリースするまでの話 / The Road to Release: Buiding AI Conversational Analytics
yappli_developers
0
170
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
550
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3.2k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Google's AI Overviews - The New Search
badams
0
1.7k
Done Done
chrislema
187
17k
Evolving SEO for Evolving Search Engines
ryanjones
0
370
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
WENDY [Excerpt]
tessaabrams
15
41k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
sira's awesome portfolio website redesign presentation
elsirapls
0
510
Odyssey Design
rkendrick25
PRO
3
960