O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

徒手打造自己的粉專客服機器人

1.670 visualizações

Publicada em

Laravel Conference Taiwan 2018
Sasaya @ 張榮發文教基金會 國際會議中心

Publicada em: Tecnologia
  • Login to see the comments

徒手打造自己的粉專客服機器人

  1. 1. 徒⼿手打造⾃自⼰己的 粉專客服機器⼈人 L a r a v e l C o n f e r e n c e Ta i w a n 2 0 1 8 S a s a y a @ 張 榮 發 ⽂文 教 基 ⾦金金 會 國 際 會 議 中 ⼼心
  2. 2. • Full-Stack Web Developer @ UniSharp • Favorites: • CLI, Vim • Laravel, Vue.js • Percussion (Music) Sasaya
  3. 3. 什什麼是聊天機器⼈人?
  4. 4. 🤖 💬
  5. 5. 🤖 💬
  6. 6. # 🤖 💬 X
  7. 7. 🤖 💬 能做什什麼?
  8. 8. 訂餐
  9. 9. 玩遊戲
  10. 10. 賣東⻄西
  11. 11. 客服
  12. 12. LaravelConf 台灣
  13. 13. 抽卡
  14. 14. 開關鐵⾨門
  15. 15. 還有⼀一⼤大堆 ...
  16. 16. 為什什麼要⽤用 🤖 💬 ?
  17. 17.
  18. 18. 懶懶
  19. 19. 耐⼼心
  20. 20. 💰
  21. 21. 開始打造超簡單的 🤖 💬
  22. 22. BotMan
  23. 23. BotMan 是什什麼?
  24. 24. 為什什麼選⽤用 BotMan?
  25. 25. 🤖 💬X
  26. 26. Laravel
  27. 27. $ composer global require botman/installer 安裝 BotMan Studio Installer
  28. 28. $ botman new facebook-bot 建立 BotMan Studio 專案
  29. 29. $ php artisan botman:list-drivers 看看⽀支援什什麼 Driver
  30. 30. $ php artisan botman:install-driver facebook 安裝 Facebook Driver
  31. 31. $ php artisan botman:list-drivers 確定⼀一下安裝是否成功
  32. 32. 建立 Facebook App
  33. 33. W T F
  34. 34. W T F
  35. 35. W T F
  36. 36. # .env FACEBOOK_TOKEN=xxxxxxxxxx 設定 Page Access Token
  37. 37. $ valet link $ valet share 使⽤用 Laravel Valet
  38. 38. # .env FACEBOOK_VERIFICATION=xxxxxxxxxx 設定 Verify Token
  39. 39. 開始跟 🤖 💬 對話
  40. 40. # routes/botman.php $botman = resolve('botman'); $botman->hears('Hi', function ($bot) { $bot->reply('Hello!'); });
  41. 41. THE END
  42. 42. 騙你的啦 XD
  43. 43. 問答模式
  44. 44. # routes/botman.php $botman->hears('Hello', function ($bot) { $bot->startConversation( new HelloConversation ); });
  45. 45. # app/Conversations/HelloConversation.php $this->ask( 'Hello! What is your name?', function (Answer $answer) { $this->say( 'Nice to meet you ' . $answer->getText() ); } );
  46. 46. 看起來來很厲害的樣板們
  47. 47. $bot->reply( ButtonTemplate::create('How do you like BotMan so far?') ->addButton( ElementButton::create('Quiet good') ->type('postback') ->payload('good') ) ->addButton( ElementButton::create('Love it!') ->url('http://botman.io/') ) );
  48. 48. $bot->reply( ListTemplate::create() ->useCompactView() ->addGlobalButton( ElementButton::create('view more')->url('http://test.at') ) ->addElement( Element::create('BotMan Documentation') ->subtitle('All about BotMan') ->image('http://botman.io/img/botman-body.png') ->addButton( ElementButton::create('tell me more') ->type('postback')->payload('more') ) ) );
  49. 49. $bot->reply( MediaTemplate::create() ->element( MediaAttachmentElement::create('image') ->attachmentId('1543527005693234') ->addButton( ElementButton::create('Tell me more') ->type('postback')->payload('more') ) ->addButton( ElementButton::create('Documentation') ->url('https://botman.io/') ) ) );
  50. 50. $bot->reply( GenericTemplate::create() ->addImageAspectRatio(GenericTemplate::RATIO_SQUARE) ->addElements([ Element::create('BotMan Documentation') ->subtitle('All about BotMan') ->image('http://botman.io/img/botman-body.png') ->addButton( ElementButton::create('visit')->url('http://botman.io') ) ->addButton( ElementButton::create('tell me more') ->type(‘postback')->payload('more') ) ]) );
  51. 51. $bot->reply( ReceiptTemplate::create() ->recipientName('Christoph Rumpel') ->merchantName('BotMan GmbH') ->orderNumber('342343434343') ->timestamp('1428444852') ->orderUrl('http://test.at') ->currency('USD') ->paymentMethod('VISA') ->addElement( ReceiptElement::create('T-Shirt Small')->price(15.99)->image('http://botman.io/img/botman-body.png') ) ->addElement( ReceiptElement::create('Sticker')->price(2.99)->image('http://botman.io/img/botman-body.png') ) ->addAddress( ReceiptAddress::create()->street1('Watsonstreet 12')->city('Bot City’) ->postalCode(100000)->state('Washington AI')->country('Botmanland') ) ->addSummary( ReceiptSummary::create()->subtotal(18.98)->shippingCost(10)->totalTax(15)->totalCost(23.98) ) ->addAdjustment(ReceiptAdjustment::create('Laravel Bonus')->amount(5)) );
  52. 52. ⾃自然語⾔言分析
  53. 53. 什什麼是⾃自然語⾔言?
  54. 54. 師⽗父吃海海鮮$albert->eat($seafoods);
  55. 55. wit.ai
  56. 56. $bot->getMessage()->getExtras('nlp')['entities']; // Request: 我想買票 // Entities: [ // 'ask_ticket' => [ // [ // 'confidence' => 0.94426018154179, // 'value' => '買票', // ] // ] // ]
  57. 57. 機器學習
  58. 58. 什什麼是機器學習?
  59. 59. PHP-ML
  60. 60. $manager = new ModelManager; $classifier = $manager->restoreFromFile( resource_path('datas/phpml') ); $id = $classifier->predict($tags);
  61. 61. 可是我不想⾃自⼰己訓練 沒有現成的可以⽤用嗎?
  62. 62.
  63. 63. 圖靈 123
  64. 64. 權限審核
  65. 65. FB 的審核其實不隨便便
  66. 66. 企業驗證
  67. 67. TDD、CDD、DDD
  68. 68. Q & A

×