SlideShare uma empresa Scribd logo
1 de 99
Baixar para ler offline
Modern Web 2016
Using Golang to build smart IM Bot
Evan Lin @LinkerNetworkshttp://goo.gl/IYv1BU
About Me
• Cloud Architect @ Linker
Networks
• Top 10 Taiwan Golang open
source contributor (github
award)
• Developer, Curator, Blogger
Agenda
• What is IM Bot
• Introduce Golang
• Build Line Bot
• Build FB Bot
• Build a smart IM Bot
• Future
• Q&A
Instant Message Bot
What is IM?
(Instant Messenger)
What is IM Bot?
How to choose
programming language
• Easy to Write
• Fast in Run and
Compile
• Powerful Concurrency
• Powerful Built-in
Toolchain
Pokemon GO
Programming GO
What is Go(lang)
• Create by Google
• Design by
• Ken Thompson
• Rob Pike
• Robert Griesemer,
• Feature:
• Compiled
• Statically Typed
• Garbage Collection
Why Golang
• GO Fast!
• Compile Fast!
• Run Fast!
Go is Fast
Why Golang
• Make programming
fun again.
gofmt / goimport
Before we look code
Before we look code (cont)
After file save..
Go Vet
Analysis on source code and reports
suspicious constructs.
Go Lint
Coding style suggestions
GoRoutine:
Multiple Thread in C
GoRoutine:
Multiple Thread in Go
GoRoutine and Channel:
Multiple Thread in Go
GoRoutine and Channel:
Multiple Thread in Go
GoRoutine and Channel:
Multiple Thread in Go
https://talks.golang.org/2014/gocon-tokyo.slide
Golang - HTTPS Server
Golang - HTTPS Server
Supported
HTTP/2
After Go 1.6
Golang - Built-In Test
Golang - Built-In Benchmark Test
GoMobile
Original Work Flow
Golang
Sample Console
Sometime Failed
Work
Failed on Some Model
GoMobile
Using Golang in Mobile
Golang
GoMobile
Package


Golang
Sample Console
Go Playground:
Write A snippet Go code online
https://play.golang.org/
Go JSON Tutorial
Go JSON Tutorial
Go JSON Tutorial
Golang IDE
(Integrated Development Environment)
Golang IDE
(Integrated Development Environment)
VIM-GO
Golang IDE
(Integrated Development Environment)
Visual Studio Code Go Extension
Let’s build IM Bot.
Wait!
What is IM Bot working
flow?
IM Bot Working Flow:
HTTPS Webhook
How to prepare HTTPS
server?
• Prepare a machine with
public IP
• Install related OS and
runtime for your
programming language
• Purchase CA signed for
SSL Key ($$)
• Run a HTTPS Webserver
(Apache or Go native
Web Server)
Introduce Heroku
(Platform As A Service)
Free-tier
Heroku
(Platform As A Service)
• Free-tier:
• USES AN ACCOUNT-
BASED POOL
• OF FREE DYNO HOURS
• SLEEPS AFTER 30 MINS OF
INACTIVITY
• CUSTOM DOMAINS
• HTTPS connection (for
non-custom domains)
• Support one click deploy
IM Bot Working Flow
(update)
HTTPS Webhook
Build IM Line Bot
Step 1: Request Line Bot Trial Account
Apply Line Bot trial account here
(Only 1 per Line Account)
Step 2: Deploy to Heroku by
one click
Link : https://github.com/kkdai/LineBotTemplate
Step 2: Deploy to Heroku by
one click
Remember this address
Step 3. Fill your Heroku App
Callback address to Line Bot
• Copy your app
address from
Heroku to Line
Dashboard.
• It will be something
like “https://
xxxxxx.herokuapp.
com:443/callback”
Fill your app dress here
Step 4. Get related Line Bot
info for Heroku App setting
• Need copy
following
variable:
• Channel ID
• Channel Secret
• MID
Need copy those three
Step 5. Fill your Line Bot
Information to Heroku Variables
• In Heroku [Dashboard] ->
[Settings]-> [Config
Variables]
• Create following variables:
• ChannelID
• ChannelSecret
• MID
• Fill with you just got from
Line Bot Dashboard.
Send a Image to user
Parse bot request to received result
Send a Image to user
Make sure it is text message not operation
Send a Image to user
Send image to who text to the bot
“Hello” message from Line
Bot
Hello
Send a “Hello” message when add bot as
friend
Determine the operation type
Send a “Hello” message when add bot as
friend
Get request from ID, this is only way for now
Example: PetNeedMe
https://github.com/kkdai/LineBotPetNeedMe
Build Facebook Bot
Step 1: Deploy to Heroku
Link : https://github.com/kkdai/FBBotTemplate
Remember this address
Step 2: Create Facebook
Page
Step 3: Create App for
Messenger
• Create new app
“Web App”
• Select new
product
“Messenger”
Step 4: Create App Token
• Select generate
token.
• Need a “Page”
Step 5: Paste token to
Heroku Variable
Step 6: Setup Page
Subscription for Messenger Bot
https://APP_ADDRESS.herokuapp.com/webhook
Token we just generate
Step 7: Select a Page for
your Webhooks
Step 8: Select a Page for
your Webhooks
Example: PetNeedMe
Build A Smart IM Bot
IM ?
IM Bot 10 years ago
“ ”
: https://briian.com/2536/msn-bot.html
IM Bot 10 years later
“Fugle ”
• Left Brain
• Logical
• Verbal
• Language
?
?
?
?
?
?
?
?
?
?
?
Intent: ??
Entity: ??
?
Intent: Check Weather
Entity: ??
?
Intent: Check Weather
Entity: Taipei
Use LUIS to build smart
Bot
Use LUIS to build smart
Bot
LUIS
Other Natural Language
Processing Tool
Future
Future :
Bot to Bot (No more API)
Future :
Customer Service Bot
http://www.mobile01.com/topicdetail.php?f=383&t=4078424
Future :
For Your Website and Business
Future :
For Your Website and Business
Future :
How About Build Right Brain?
We are Hiring..

1. NFV/SDN Expert
2. Data Engineer
http://weekly.codetengu.com/
Go
Call For Speaker

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Using the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to Bitbucket
 
Golang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introductionGolang for PHP programmers: A practical introduction
Golang for PHP programmers: A practical introduction
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Provisioning environments. A simplistic approach
Provisioning  environments. A simplistic approachProvisioning  environments. A simplistic approach
Provisioning environments. A simplistic approach
 
GitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorialGitLab 8.5 Highlights and Step-by-step tutorial
GitLab 8.5 Highlights and Step-by-step tutorial
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
Golang online course
Golang online courseGolang online course
Golang online course
 
How to master a programming language: a Golang example"
How to master a programming language: a Golang example"How to master a programming language: a Golang example"
How to master a programming language: a Golang example"
 
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
Introduction to Git(BitBucket) , Continuous Integration (Bamboo) & Confluence
 
Git Ready! Workflows
Git Ready! WorkflowsGit Ready! Workflows
Git Ready! Workflows
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
The development workflow of git github for beginners
The development workflow of git github for beginnersThe development workflow of git github for beginners
The development workflow of git github for beginners
 
Using the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to Bitbucket
 
13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications13 practical tips for writing secure golang applications
13 practical tips for writing secure golang applications
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
React Native
React NativeReact Native
React Native
 
Introduction to github slideshare
Introduction to github slideshareIntroduction to github slideshare
Introduction to github slideshare
 
O365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van RousseltO365Con18 - Git and GitHub - Rick van Rousselt
O365Con18 - Git and GitHub - Rick van Rousselt
 
CI is dead, long live CI
CI is dead, long live CICI is dead, long live CI
CI is dead, long live CI
 
Revolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOpsRevolutionize Your Workflow with ChatOps
Revolutionize Your Workflow with ChatOps
 

Semelhante a Modern Web 2016: Using Golang to build a smart IM Bot

201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio
Neo Hsu
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
Nicholas Jansma
 

Semelhante a Modern Web 2016: Using Golang to build a smart IM Bot (20)

Build your first messenger bot
Build your first messenger botBuild your first messenger bot
Build your first messenger bot
 
Let's Build a Chatbot
Let's Build a ChatbotLet's Build a Chatbot
Let's Build a Chatbot
 
Bot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent EllerbachBot. You said bot? Let build bot then! - Laurent Ellerbach
Bot. You said bot? Let build bot then! - Laurent Ellerbach
 
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
 
Build your first Chatbot
Build your first ChatbotBuild your first Chatbot
Build your first Chatbot
 
Introduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLPIntroduction to Facebook Messenger, Conversational UI & NLP
Introduction to Facebook Messenger, Conversational UI & NLP
 
201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio
 
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
 
Getting Started With bots
Getting Started With botsGetting Started With bots
Getting Started With bots
 
Building Enterprise Chat Bots
Building Enterprise Chat BotsBuilding Enterprise Chat Bots
Building Enterprise Chat Bots
 
Chatbot ppt
Chatbot pptChatbot ppt
Chatbot ppt
 
Build and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 MinsBuild and Deploy a Python Web App to Amazon in 30 Mins
Build and Deploy a Python Web App to Amazon in 30 Mins
 
Appcelerator Titanium Intro
Appcelerator Titanium IntroAppcelerator Titanium Intro
Appcelerator Titanium Intro
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework
 
BeEF_EUSecWest-2012_Michele-Orru
BeEF_EUSecWest-2012_Michele-OrruBeEF_EUSecWest-2012_Michele-Orru
BeEF_EUSecWest-2012_Michele-Orru
 
Creating and Deploying a Bot Service Using the Bot Framework and Visual Studio
Creating and Deploying a Bot Service Using the Bot Framework and  Visual StudioCreating and Deploying a Bot Service Using the Bot Framework and  Visual Studio
Creating and Deploying a Bot Service Using the Bot Framework and Visual Studio
 
Automation in iOS development
Automation in iOS developmentAutomation in iOS development
Automation in iOS development
 
Git and git hub basics
Git and git hub basicsGit and git hub basics
Git and git hub basics
 
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
 
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
Building a Slack Bot Workshop @ Nearsoft OctoberTalks 2017
 

Mais de Evan Lin

Mais de Evan Lin (13)

好書分享: 一人公司 Company Of One
好書分享:  一人公司  Company Of One好書分享:  一人公司  Company Of One
好書分享: 一人公司 Company Of One
 
How I become Go GDE
How I become Go GDEHow I become Go GDE
How I become Go GDE
 
iThome Modern Web 2018: 如何打造高效的機器學習平台
iThome Modern Web 2018: 如何打造高效的機器學習平台iThome Modern Web 2018: 如何打造高效的機器學習平台
iThome Modern Web 2018: 如何打造高效的機器學習平台
 
Kubernetes secret introduction
Kubernetes secret introductionKubernetes secret introduction
Kubernetes secret introduction
 
Consistent hashing algorithmic tradeoffs
Consistent hashing  algorithmic tradeoffsConsistent hashing  algorithmic tradeoffs
Consistent hashing algorithmic tradeoffs
 
GTG30: Introduction vgo
GTG30: Introduction vgoGTG30: Introduction vgo
GTG30: Introduction vgo
 
Kubernetes v.s. mesos
Kubernetes v.s. mesosKubernetes v.s. mesos
Kubernetes v.s. mesos
 
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
iTHome Gopher Day 2017: What can Golang do?  (Using project 52 as examples)iTHome Gopher Day 2017: What can Golang do?  (Using project 52 as examples)
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
 
iThome Cloud Summit: The next generation of data center: Machine Intelligent ...
iThome Cloud Summit: The next generation of data center: Machine Intelligent ...iThome Cloud Summit: The next generation of data center: Machine Intelligent ...
iThome Cloud Summit: The next generation of data center: Machine Intelligent ...
 
Google APAC Machine Learning Expert Day
Google APAC Machine Learning Expert DayGoogle APAC Machine Learning Expert Day
Google APAC Machine Learning Expert Day
 
Use go channel to write a disk queue
Use go channel to write a disk queueUse go channel to write a disk queue
Use go channel to write a disk queue
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
Docker introduction in Hardware Company
Docker introduction in Hardware CompanyDocker introduction in Hardware Company
Docker introduction in Hardware Company
 

Último

一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
Asmae Rabhi
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
galaxypingy
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 

Último (20)

一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 

Modern Web 2016: Using Golang to build a smart IM Bot