SlideShare a Scribd company logo
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
Modern Web 2016: Using Golang to build a smart IM Bot
Why Golang
• Make programming
fun again.
gofmt / goimport
Before we look code
Before we look code (cont)
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
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 ”
Modern Web 2016: Using Golang to build a smart IM Bot
Modern Web 2016: Using Golang to build a smart IM Bot
• 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

More Related Content

PDF
Gopher Taiwan Gathering #16: Build a smart bot via Golang
PDF
Host Line Bot with Golang
PDF
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
PDF
Project52
PDF
Golang taipei #45 10th birthday
PDF
Git workflow in agile development
PDF
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
PPTX
GitLab 8.6 - Release Webcast
Gopher Taiwan Gathering #16: Build a smart bot via Golang
Host Line Bot with Golang
COSCUP 2016: Project 52 每週一個小專案來學習 Golang
Project52
Golang taipei #45 10th birthday
Git workflow in agile development
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
GitLab 8.6 - Release Webcast

What's hot (20)

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

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

PDF
Build your first messenger bot
PPTX
Let's Build a Chatbot
PPTX
GitHub_Copilot_Presentasasaasaation.pptx
PDF
Bot. You said bot? Let build bot then! - Laurent Ellerbach
PPTX
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
PPTX
Build your first Chatbot
PDF
Introduction to Facebook Messenger, Conversational UI & NLP
PDF
201507_NeoHsu_Portfolio
PDF
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
PPTX
Getting Started With bots
PDF
Building Enterprise Chat Bots
PPTX
Chatbot ppt
ODP
Build and Deploy a Python Web App to Amazon in 30 Mins
PPTX
Appcelerator Titanium Intro
PPTX
How to Create a WhatsApp Chatbot using Flask Python Framework
PDF
BeEF_EUSecWest-2012_Michele-Orru
PPTX
Creating and Deploying a Bot Service Using the Bot Framework and Visual Studio
PDF
Automation in iOS development
PPTX
Git and git hub basics
PDF
How to get trusted AI in your favorite IDE
Build your first messenger bot
Let's Build a Chatbot
GitHub_Copilot_Presentasasaasaation.pptx
Bot. You said bot? Let build bot then! - Laurent Ellerbach
ITCamp 2017 - Laurent Ellerbach - Bot. You said bot? Let's build a bot then...
Build your first Chatbot
Introduction to Facebook Messenger, Conversational UI & NLP
201507_NeoHsu_Portfolio
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
Getting Started With bots
Building Enterprise Chat Bots
Chatbot ppt
Build and Deploy a Python Web App to Amazon in 30 Mins
Appcelerator Titanium Intro
How to Create a WhatsApp Chatbot using Flask Python Framework
BeEF_EUSecWest-2012_Michele-Orru
Creating and Deploying a Bot Service Using the Bot Framework and Visual Studio
Automation in iOS development
Git and git hub basics
How to get trusted AI in your favorite IDE
Ad

More from Evan Lin (13)

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

Recently uploaded (20)

PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
Internet___Basics___Styled_ presentation
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
INTERNET------BASICS-------UPDATED PPT PRESENTATION
The Internet -By the Numbers, Sri Lanka Edition
An introduction to the IFRS (ISSB) Stndards.pdf
Design_with_Watersergyerge45hrbgre4top (1).ppt
522797556-Unit-2-Temperature-measurement-1-1.pptx
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Internet___Basics___Styled_ presentation
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Unit-1 introduction to cyber security discuss about how to secure a system
Module 1 - Cyber Law and Ethics 101.pptx
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Introuction about ICD -10 and ICD-11 PPT.pptx
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
presentation_pfe-universite-molay-seltan.pptx
Slides PPTX World Game (s) Eco Economic Epochs.pptx
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
Sims 4 Historia para lo sims 4 para jugar
SASE Traffic Flow - ZTNA Connector-1.pdf

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