Slide 1

Slide 1 text

Modern Web 2016 Using Golang to build smart IM Bot Evan Lin @LinkerNetworks

Slide 2

Slide 2 text

Agenda • Introduce Golang • Build Line Bot • Build FB Bot • Build a smart IM Bot • Future • Q&A

Slide 3

Slide 3 text

About Me • Cloud Architect @ Linker Networks • Top 10 Taiwan Golang open source contributor (github award) • Developer, Curator, Blogger

Slide 4

Slide 4 text

What is Go(lang) • Create by Google • Design by • Ken Thompson • Rob Pike • Robert Griesemer, • Feature: • Compiled • Statically Typed • Garbage Collection

Slide 5

Slide 5 text

Why Golang • GO Fast! • Compile Fast! • Run Fast!

Slide 6

Slide 6 text

Why Golang

Slide 7

Slide 7 text

Why Golang • Make programming fun again.

Slide 8

Slide 8 text

gofmt / goimport

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

After file save..

Slide 12

Slide 12 text

GoRoutine: Multiple Thread in C

Slide 13

Slide 13 text

GoRoutine: Multiple Thread in Go

Slide 14

Slide 14 text

Golang - HTTPS Server

Slide 15

Slide 15 text

Golang - HTTPS Server Supported HTTP/2 After Go 1.6

Slide 16

Slide 16 text

Golang - Built-In Test

Slide 17

Slide 17 text

Golang - Built-In Benchmark Test

Slide 18

Slide 18 text

Build Line Bot

Slide 19

Slide 19 text

Step 1: Request Line Bot Trial Account Apply Line Bot trial account here (Only 1 per Line Account)

Slide 20

Slide 20 text

Step 2: Deploy to Heroku by one click Link : https://github.com/kkdai/LineBotTemplate

Slide 21

Slide 21 text

Step 2: Deploy to Heroku by one click Remember this address

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

Step 4. Get related Line Bot info for Heroku App setting • Need copy following variable: • Channel ID • Channel Secret • MID Need copy those three

Slide 24

Slide 24 text

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.

Slide 25

Slide 25 text

Send a Image to user Parse bot request to received result

Slide 26

Slide 26 text

Send a Image to user Make sure it is text message not operation

Slide 27

Slide 27 text

Send a Image to user Send image to who text to the bot

Slide 28

Slide 28 text

“Hello” message from Line Bot Hello

Slide 29

Slide 29 text

Send a “Hello” message when add bot as friend Determine the operation type

Slide 30

Slide 30 text

Send a “Hello” message when add bot as friend Get request from ID, this is only way for now

Slide 31

Slide 31 text

Example: PetNeedMe https://github.com/kkdai/LineBotPetNeedMe

Slide 32

Slide 32 text

Build Facebook Bot

Slide 33

Slide 33 text

Step 1: Deploy to Heroku Link : https://github.com/kkdai/FBBotTemplate

Slide 34

Slide 34 text

Remember this address

Slide 35

Slide 35 text

Step 2: Create Facebook Page

Slide 36

Slide 36 text

Step 3: Create App for Messenger • Create new app “Web App” • Select new product “Messenger”

Slide 37

Slide 37 text

Step 4: Create App Token • Select generate token. • Need a “Page”

Slide 38

Slide 38 text

Step 5: Paste token to Heroku Variable

Slide 39

Slide 39 text

Step 6: Setup Page Subscription for Messenger Bot https://APP_ADDRESS.herokuapp.com/webhook Token we just generate

Slide 40

Slide 40 text

Step 7: Select a Page for your Webhooks

Slide 41

Slide 41 text

Step 8: Select a Page for your Webhooks

Slide 42

Slide 42 text

Example: PetNeedMe

Slide 43

Slide 43 text

Build A Smart IM Bot

Slide 44

Slide 44 text

֦ጱ IM 秚瑊Ո䄪肦ก㻟?

Slide 45

Slide 45 text

IM Bot 10 years ago “磪㺔஠螈” 瑽粙᯿箑ᇰՈ: https://briian.com/2536/msn-bot.html

Slide 46

Slide 46 text

IM Bot 10 years later “Fugle胂૱ੜ䒻ಋ”

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

• Left Brain • Logical • Verbal • Language

Slide 50

Slide 50 text

ݣ玖ॠ穥ই֜?

Slide 51

Slide 51 text

ݣ玖ॠ穥ই֜? ݣ玖磪ӥ襁㻟?

Slide 52

Slide 52 text

ݣ玖ॠ穥ই֜? ݣ 玖 獖 㻟 ? ݣ 玖 ॠ 穥 অ 㻟 ? ݣ 玖 ॠ 穥 ெ 讕 䰬 ? ݣ玖ॠ绚ฎՋ讕氅ᜋ? ݣ玖磪ӥ襁㻟? ݄ݣ玖襑ᥝ癲㯩㻟?

Slide 53

Slide 53 text

ݣ玖ॠ穥ই֜? Intent: ?? Entity: ??

Slide 54

Slide 54 text

ݣ玖ॠ穥ই֜? Intent: Check Weather Entity: ??

Slide 55

Slide 55 text

ݣ玖ॠ穥ই֜? Intent: Check Weather Entity: Taipei

Slide 56

Slide 56 text

Use LUIS to build smart Bot

Slide 57

Slide 57 text

Use LUIS to build smart Bot

Slide 58

Slide 58 text

LUIS

Slide 59

Slide 59 text

Future

Slide 60

Slide 60 text

Future : Bot to Bot (No more API) \

Slide 61

Slide 61 text

Future : Customer Service Bot http://www.mobile01.com/topicdetail.php?f=383&t=4078424

Slide 62

Slide 62 text

Future : For Your Website and Business

Slide 63

Slide 63 text

Future : For Your Website and Business

Slide 64

Slide 64 text

Future : How About Build Right Brain? \

Slide 65

Slide 65 text

\

Slide 66

Slide 66 text

Q&A \