顯示具有 alexa 標籤的文章。 顯示所有文章
顯示具有 alexa 標籤的文章。 顯示所有文章

2018年12月24日 星期一

如何建立 Aexa Web Service ?


建立 alexa web service 需要以下幾個步驟∶

  • 建立web server (Restful Web API)
  • 建立憑證 (可用私有憑證) 
  • alexa configuration
  • service simulator 

建立web server (Restful Web API)
  • alexa-app: 
    • 已對 alexa voice service 寫好對應的方法及模組,可快速進行開發
    • A Node module to simplify the development of Alexa skills (applications.) 
    • https://github.com/alexa-js/alexa-app

  • alexa-app-server: 
    • 基於上述 alexa-app module 提供 web server 服務,方便開發人員串接 alexa vocie service
    • An Alexa App (Skill) Server module using Node.js and the alexa-app module. 
    • The alexa-app-server module offers a stand-alone web server to host Alexa Apps (Skills). 
    •  Think of it as a simple "container" that allows you to easily publish multiple Alexa Apps with one server. 
    •  This module does not help you write the Alexa Apps (Skills) themselves, as apps are independent modules, written using the alexa-app framework. URL: 
    • https://alexasaturn.tk/alexa/color_picker



建立憑證 (可用私有憑證)

  • Create self-signed certificate語法如下∶
  • 此處要注意一點,必須申請 DNS 並寫入憑證內,才可正常串接服務



alexa configuration
  • Configuration 勾選 Https
  • Default 輸入 URL

  • Self-signed SSL Certificate 
    • 勾選 I will upload a self-signed certificate in X.509 format 
    • 再將憑證內容貼上

service simulator

  • 可用 Test 下的 service simulator 進行測試



Alexa 架構



Alexa 是什麼?

亞馬遜公司所發售Amazon Echo(智慧喇叭)內搭載的智慧型語音助理 - Alexa


Alexa 能做些什麼?

在於「操作顛覆」,其他已上市的 IoT 系統幾乎以「觸控」操作來完成,語音助理 Siri、Google Now 只能做為輔助工具,在 Amazon Echo,以語音為主要操控方式,使用者只靠說話就能與之互動,透過語音下達指令,Alexa 可以為你閱讀新聞、查看天氣與交通狀況,撥流行音樂、確認行事曆、訂Pizza、叫車、買東西等,可說是一款語音助理與生活相互融合的絕佳範例。


開發者可用Alexa Skills Kit 開發自己的Alexa Skill。例如美國最大的餐點外送公司Grubhub在Alexa 上的開頭語是:「Alexa, tell Grubhub I’m hungry」;Uber 則是用:「Alexa, ask Uber to request a ride!」。許多企業都在思考該如何以最直覺的方式讓人們完成點餐、搭車等等的服務,讓消費者更快下決定,有效提高下單率!

架構

  • Framework: alexa-app-server (nodejs) 
  • 溝通需使用 https (self-signed certificate 需參考官方文件) 
  • Backend 主要的對象是 Intent event,依不同的event進行回應 
  • 依需求,溝通過程不主動關閉 session 需在8秒內回應 response,否則將被強制關閉 session


Intent 範例