ãã®è¨äºã¯ãããçã¡ãã Advent Calendar 2016ãã®20æ¥ç®ã®è¨äºã§ãã
Microsoftãæä¾ãã¦ããBot Frameworkã«ã¤ãã¦æ¸ãã¦ã¿ããã¨æãã¾ãã
ãã®è¨äºã§ã¯Visual Studio 2017 RCã§C#ã使ã£ã¦ãã¾ããã¾ããWebãµã¼ãã¹å´ã¯Azure Web Appsã使ã£ã¦ãã¾ãã
Microsoft Bot Frameworkã¨ã¯ï¼
ä¸è¨ã§ããã¨ãMicrosoftãæä¾ãã¦ããBotãä½ãããã®Frameworkã§ãï¼ãã
SlackãFacebook Messengerãªã©ã®ãµã¼ãã¹ã«å¯¾å¿ããBotãä½ããã¨ãã§ãã¾ãã
å¿ è¦ãªãã®
- Microsoftã¢ã«ã¦ã³ã
- èªåãä½ã£ãWebãµã¼ãã¹ã®ç½®ãå ´æï¼ä»åã¯Azure Web Appsï¼
ä½ãæ¹
Microsoft Bot Frameworkã«ã¦Botãç»é²
Microsoft Bot Framework ã®ãã¼ã¸ããããRegister a Botããã¾ãã
é©å½ã«ååãã¢ã¤ã³ã³ãè¨å®ãã¦ã
ãCreate Microsoft App ID and passwordããæ¼ãã¨
å¥ã®ã¿ãã§ã¢ããªã±ã¼ã·ã§ã³ä½æç»é¢ãéãã®ã§ãå¿ è¦äºé ãè¨å ¥ãã¦ä½æãã¾ãã ä½æããã¨App IDããã¹ã¯ã¼ããçºè¡ãããã®ã§å¤§äºã«ä¿ç®¡ãã¦ããã¾ãã
å ã®ç»é¢ã§ä½æããã¢ããªã±ã¼ã·ã§ã³ã®App IDãWebãµã¼ãã¹ã®ã¨ã³ããã¤ã³ããæå®ãã¦ããã¾ãã§ãã
ã¡ãªã¿ã«ãã¨ã³ããã¤ã³ãã¯SSLæ¥ç¶ã§ããå¿ è¦ãããã¾ãã
ä½æãå®äºããã¨ãMy botsã®ãã¼ã¸ãéãã¾ãã
ãBotã¢ããªã±ã¼ã·ã§ã³ä½æç¨ã®ãã³ãã¬ã¼ãããã¦ã³ãã¼ãï¼ã¤ã³ã¹ãã¼ã«
Bot Frameworkç¨ã®ããã¸ã§ã¯ããã³ãã¬ã¼ããå ¬éããã¦ããã¾ãã®ã§ãããå©ç¨ãã¾ãã
ããããããã³ãã¬ã¼ãããã¦ã³ãã¼ããã¾ãã
ãã¦ã³ãã¼ããããBot Application.zipããVisual Studioã®ãã³ãã¬ã¼ããã£ã¬ã¯ããªï¼%USERPROFILE%\Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#\
ï¼ã«ä¿åãã¾ãã
ããã¸ã§ã¯ãã®ä½æ
Visual Studioã«ã¦æ°ããããã¸ã§ã¯ããä½æãã¾ãã
ãã¼ã«ã«å®è¡ã¯Bot Framework Emulatorã§
ãã¼ã«ã«ç°å¢ã§å®è¡ããããã®ã¨ãã¥ã¬ã¼ã¿ã¼ãå ¬éããã¦ãã¾ãã
ã¤ã³ã¹ãã¼ã«ãã¦å®è¡ããã¨ãããã®ãããªç»é¢ãéãã¾ãã®ã§ããã¼ã«ã«ã®ã¨ã³ããã¤ã³ããæå®ãã¦ããã¾ãããã®éãApp IDã¨App Passwordã確èªããã¾ããããã¼ã«ã«å®è¡ã§ã¯ç©ºæ¬ã«ãã¦ããã¾ãã
ä½æããããã¸ã§ã¯ãããããã°å®è¡ãã¦ãBot Framework Emuratorããã¡ãã»ã¼ã¸ãéãã¨ä»¥ä¸ã®ããã«ãªãã¾ãã
Web App ã®è¨å®
Botã«é¢ããä¸è¨è¨å®ã Web App ã®ããªã±ã¼ã·ã§ã³è¨å®ã«è¿½å ãã¾ãã
- BotId
- MicrosoftAppId
- MicrosoftAppPassword
web.configã«ç´æ¥æ¸ãã¦ãåãã¾ããã©ããã£ãããããã¨ãããã®ã§ç´æ¥æ¸ããªãæ¹ãããã¨æãã¾ãã
çºè¡
好ããªæ¹æ³ã§Azureã«çºè¡ãã¾ãã
åä½ç¢ºèª
Bot Frameworkã®ãã¼ã¿ã«
Bot Frameworkã®My Botsãã¼ã¸ãããæ¥ç¶ç¢ºèªãå®éã«ã¡ãã»ã¼ã¸ãéã£ã¦ã®åä½ç¢ºèªãã§ãã¾ãã
Bot Framework Emulator
Bot Framework Emulatorã§ãåãããã«ç¢ºèªãã§ãã¾ããããªã¢ã¼ããã¹ãã¸ã®æ¥ç¶ã«ãªãã®ã§ngrokãå¿ è¦ã«ãªãã¾ãã
ngrokã®ãã¦ã³ãã¼ããã¼ã¸ããç°å¢ã«ãã£ããã¤ããªããã¦ã³ãã¼ããã¦ãé©å½ãªå ´æã«è§£åãã¾ãããã®å¾ãBot Framework Emulatorã®App Settingsããngrokã®ãã¹ãè¨å®ãã¾ãã
対å¿ããWebãµã¼ãã¹ã®è¨å®
ãããã¤ï¼åä½ç¢ºèªãã§ããã°ããã®Botã使ããWebãµã¼ãã¹ã®è¨å®ãè¡ãã¾ãã
Bot Frameworkã®My Botsãã¼ã¸ã®ä¸ã®æ¹ã«å¯¾å¿ãã¦ããWebãµã¼ãã¹ï¼Channelï¼ã®ä¸è¦§ã表示ããã¦ãã¾ããä»åã¯Slackã§ä½¿ããããã«ãã¦ã¿ããã¨æãã¾ãã®ã§ããAddããã¯ãªãã¯ãã¾ãã
ããã¨ãSlackã§ä½¿ãããã®HowToã表示ããã¾ãã®ã§ããã«å¾ã£ã¦è¨å®ãè¡ãã¾ãï¼éï¼
ã§ãã
ã¾ã¨ã
ããã°ã©ã ã®ä¸èº«ã¯ãã³ãã¬ã¼ããã®ã¾ã¾ãªã®ãæ®å¿µã§ãããMicrosoft Translatorã¨ãã£ãæ©æ¢°ç¿»è¨³ãµã¼ãã¹ã使ã£ã¦ãéã£ãæ¥æ¬èªãè±èªã§è¿ãã¦ããããããã¨ä¾¿å©ï¼ï¼ï¼ããªããªãã¦æã£ã¦ã¾ããããéã«åãã¾ããã§ããã
Slackã§ããã¨ã/ã³ãã³ããIncoming/Outgoing Web Hookã使ç¨ããã¢ããªã«æ¯ã¹ã¦ãBotã¢ããªã®ä½æã¯ã¡ãã£ã¨é¢åãããªã¤ã¡ã¼ã¸ãããã¾ãããããããªãå²ã¨ç°¡åã«å®è£ ã§ãã¾ããï¼ï¼æ¬æ¥è§£æ±ºãããåé¡ã«éä¸ã§ããï¼
ããã¾ãã