Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to make Alexa self client

How to make Alexa self client

2016.07.27(Wed) JAWS-UG-KOBE Study meeting
Alexa Meetup.

How to make Alexa self client basics

Avatar for haruharuharuby

haruharuharuby

July 27, 2016
Tweet

More Decks by haruharuharuby

Other Decks in Technology

Transcript

  1. 自己紹介( TiNm’S ) TiNm’S( ティムズ )と読みます。 プログラマー。 Ruby On Rails、AWSが主戦場。

    好きなAWS サービスは、OpsWorks。 花澤香菜ちゃん好き。 JAWS-UG-KOBE コアメンバー。
  2. Authorization Code Grant https://api.amazon.com/auth/o2/token POST /auth/o2/token HTTP/1.1 Host: api.amazon.com Content-Type:

    application/x-www-form-urlencoded Cache-Control: no-cache grant_type=authorization_code&code=ANBzsjhYZmNCTeAszagk&client_id=amzn1.application-oa2-client. b91a4d2fd2f64&client_secret=6963038c1c2063c33ab9eedc0cf8&redirect_uri=https%3A%2F%2Flocalhost Request [POST] Response HTTP/1.1 200 OK { "access_token": "Atza|IQEBLjAsAhRBejiZKPfn5HO2562GBt26qt23EA", "expires_in": 3600, "refresh_token": "Atzr|IQEBLzAtAhUAibmh-1N0EsdqwqwdqdasdvferrE", "token_type": "bearer" }
  3. access token の更新 https://api.amazon.com/auth/o2/token POST /auth/o2/token HTTP/1.1 Host: api.amazon.com Content-Type:

    application/x-www-form-urlencoded Cache-Control: no-cache grant_type=refresh_token&refresh_token=Atzr%7CIQEBLzAtAhUAibmh-1N0E&client_id=amzn1.application-oa2-client. b91a4d2fd2f6&client_secret=6963038c1c2063c33ab9eedc0cf822 Request [POST] Response HTTP/1.1 200 OK { "access_token": "Atza|IQEBLjAsAhRBejiZKPfn5HO2562GBt26qt23EA", "expires_in": 3600, "refresh_token": "Atzr|IQEBLzAtAhUAibmh-1N0EsdqwqwdqdasdvferrE", "token_type": "bearer" }
  4. { "context": [ { "header": { "namespace": "AudioPlayer", "name": "PlaybackState"

    }, "payload": { "token": "{{STRING}}", "offsetInMilliseconds": {{LONG}}, "playerActivity": "{{STRING}}" } } ], "event": { "header": { "namespace": "SpeechRecognizer", "name": "Recognize", "messageId": "{{STRING}}", "dialogRequestId": "{{STRING}}" }, "payload": { "profile": "CLOSE_TALK", "format": ""AUDIO_L16_RATE_16000_CHANNELS_1 } } } First Part: json object Second Part: audio binary Content-Disposition: form-data; name="audio" Content-Type: application/octet-stream {{BINARY AUDIO ATTACHMENT}}
  5. { "directive": { "header": { "namespace": "SpeechSynthesizer", "name": "Speak", "messageId":

    "{{STRING}}", "dialogRequestId": "{{STRING}}" }, "payload": { "url": "{{STRING}}", "format": "{{STRING}}", "token": "{{STRING}}" } } } First Part: json object Second Part: audio binary Content-Disposition: form-data; name="audio" Content-Type: application/octet-stream {{BINARY AUDIO ATTACHMENT}}