2. H i d e t a k a
O k a m o t o
• Digitalcube Co. Ltd.
• JAWS-UG Kyoto, Kobe
• WordCamp Kyoto 2017
3. I’ll introduce…
• Alexa Skills Kit can easy to make voice application
• AWS Lambda help you to create the Skill more easier
• Serverless Framework can manage your app code
• Node.js is good for making Alexa Skill
4. AGENDA
1. What is Alexa & Alexa Skills Kit ?
2. How to develop the Alexa Skill
3. How to test & deployment your Skill
7. Alexa is…
• The voice service that powers Amazon Echo
• Can interact with devices using voice
• Can build new voice experiences
https://developer.amazon.com/alexa
13. Published our custom Skills
https://www.amazon.com/Digitalcube-Inc-Shifter-man/dp/B07572D7N8/
14. Shifter man skills is …
• Talking about our service
• Speech out our blog content
• Source code is open.
• https://github.com/getshifter/alexa-shifterman
15. Check point
• Alexa is the voice service
• Alexa Skills Kit helps us to create App easily
• We can easy to create & deploy App by AWS
17. A u d i o
C a p t u re
A u d i o
P l a y b a c k
C a l l s o m e A P I
Ta l k
s o m t h i n g
R e s p o n c e
S p e e c h t o
Te x t
Te x t t o
S p e e c h
18. A u d i o
C a p t u re
A u d i o
P l a y b a c k
C a l l s o m e A P I
Ta l k
s o m t h i n g
R e s p o n c e
S p e e c h t o
Te x t
Te x t t o
S p e e c h
A l e x a S k i l l s K i t
19. A u d i o
C a p t u re
A u d i o
P l a y b a c k
C a l l s o m e A P I
Ta l k
s o m t h i n g
R e s p o n c e
S p e e c h t o
Te x t
Te x t t o
S p e e c h
AW S L a m b d a
We b A P I
A l e x a S k i l l s K i t
20. AWS Lambda is great Alexa’s backend
https://aws.amazon.com/lambda/
25. We can easy to write Alexa code
'use strict';
const Alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function () {
this.emit(':tell', 'Hello');
},
};
module.exports.hello = (event, context, callback) => {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(handlers);
alexa.execute();
};
26. 'use strict';
const Alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function () {
this.emit(':tell', 'Hello');
},
};
module.exports.hello = (event, context, callback) => {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(handlers);
alexa.execute();
};
We can easy to write Alexa code
L o a d a l e x a - s d k
27. 'use strict';
const Alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function () {
this.emit(':tell', 'Hello');
},
};
module.exports.hello = (event, context, callback) => {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(handlers);
alexa.execute();
};
We can easy to write Alexa code
L o a d a l e x a - s d k
D e f i n e re s p o n s e
28. 'use strict';
const Alexa = require('alexa-sdk');
const handlers = {
'LaunchRequest': function () {
this.emit(':tell', 'Hello');
},
};
module.exports.hello = (event, context, callback) => {
var alexa = Alexa.handler(event, context, callback);
alexa.registerHandlers(handlers);
alexa.execute();
};
We can easy to write Alexa code
L o a d a l e x a - s d k
D e f i n e re s p o n s e
E x e c u t e a p p l i c a t i o n
30. Can call another API (like WP API)
https://github.com/getshifter/alexa-shifterman/blob/master/index.js#L44-L67
31. Many Skills examples in GitHub
• https://github.com/alexa/
• “step-by-step” help us to know how to deploy
• All example has comment (How to customize)
• We can easy to create own Alexa Skills
38. We can easy to test own Alexa code
const conversation = require('alexa-conversation');
const app = require('../index.js');
const opts = {
name: 'Alexa Shifter man',
appId: 'your-app-id',
app: app,
handler: app.hello
};
conversation(opts)
.userSays('GetNewFactIntent')
.plainResponse
.shouldContain("Here's the shifter")
.end();
39. We can easy to test own Alexa code
const conversation = require('alexa-conversation');
const app = require('../index.js');
const opts = {
name: 'Alexa Shifter man',
appId: 'your-app-id',
app: app,
handler: app.hello
};
conversation(opts)
.userSays('GetNewFactIntent')
.plainResponse
.shouldContain("Here's the shifter")
.end();
L o a d l i b & t e s t t a rg e t
40. We can easy to test own Alexa code
const conversation = require('alexa-conversation');
const app = require('../index.js');
const opts = {
name: 'Alexa Shifter man',
appId: 'your-app-id',
app: app,
handler: app.hello
};
conversation(opts)
.userSays('GetNewFactIntent')
.plainResponse
.shouldContain("Here's the shifter")
.end();
I n i t t e s t
L o a d l i b & t e s t t a rg e t
41. We can easy to test own Alexa code
const conversation = require('alexa-conversation');
const app = require('../index.js');
const opts = {
name: 'Alexa Shifter man',
appId: 'your-app-id',
app: app,
handler: app.hello
};
conversation(opts)
.userSays('GetNewFactIntent')
.plainResponse
.shouldContain("Here's the shifter")
.end();
I n i t t e s t
D e f i n e t e s t
L o a d l i b & t e s t t a rg e t
42. Running test by mocha
$ m o c h a t e s t s
E x e c u t i n g c o n v e r s a t i o n : H e l l o A l e x a Te s t
✓ F i n i s h e d e x e c u t i n g c o n v e r s a t i o n
C o n v e r s a t i o n : H e l l o A l e x a Te s t
U s e r t r i g g e r s : H e l l o I n t e n t
✓ A l e x a ' s p l a i n t e x t re s p o n s e s h o u l d c o n t a i n : H e l l o . I ' m e x a m p l e s k i l l s
f o r y o u r s e r v e r l e s s p ro j e c t s .
✓ A l e x a ' s p l a i n t e x t re s p o n s e s h o u l d c o n t a i n : P l e a s e t e l l m e y o u r
n a m e .
U s e r t r i g g e r s : N a m e I n t e n t S L O T S : { N a m e S l o t : Ts u y o s h i }
✓ A l e x a ' s p l a i n t e x t re s p o n s e s h o u l d c o n t a i n : N i c e t o m e e t y o u ,
Ts u y o s h i . E n j o y A l e x a w o r l d !
4 p a s s i n g ( 1 6 m s )
44. “Shifter man” is tested two way
# Check the code syntax by ESLint
$ npm run lint
# Test the conversation by alexa-conversation
$ npm test
https://github.com/getshifter/alexa-shifterman/blob/master/README.md
45. Easy to create Alexa Skills, but We want to …
• Test our code in local environment
• Deploy our code automatically
• Manage our resources in AWS.
48. We can define AWS resources as YAML
service: alexa-shifter
provider:
name: aws
runtime: nodejs6.10
package:
include:
- node_modules/
functions:
hello:
handler: index.hello
events:
- alexaSkill
49. We can define AWS resources as YAML
service: alexa-shifter
provider:
name: aws
runtime: nodejs6.10
package:
include:
- node_modules/
functions:
hello:
handler: index.hello
events:
- alexaSkill
D e f i n e p ro v i d e r
50. We can define AWS resources as YAML
service: alexa-shifter
provider:
name: aws
runtime: nodejs6.10
package:
include:
- node_modules/
functions:
hello:
handler: index.hello
events:
- alexaSkill
I n c l u d e l i b r a r i e s
D e f i n e p ro v i d e r
51. We can define AWS resources as YAML
service: alexa-shifter
provider:
name: aws
runtime: nodejs6.10
package:
include:
- node_modules/
functions:
hello:
handler: index.hello
events:
- alexaSkill
I n c l u d e l i b r a r i e s
D e f i n e L a m b d a
D e f i n e p ro v i d e r
56. We can define custom resources
custom:
stage: ${opt:stage, self:provider.stage}
defaultProfile: default
logRetentionInDays:
development: "14"
production: "90"
default: "3"
resources:
Resources:
HelloLogGroup:
Properties:
RetentionInDays: ${self:custom.logRetentionInDays.${self:custom.stage},
self:custom.logRetentionInDays.default}
D e f i n e p a r a m s
57. We can define custom resources
custom:
stage: ${opt:stage, self:provider.stage}
defaultProfile: default
logRetentionInDays:
development: "14"
production: "90"
default: "3"
resources:
Resources:
HelloLogGroup:
Properties:
RetentionInDays: ${self:custom.logRetentionInDays.${self:custom.stage},
self:custom.logRetentionInDays.default}
D e f i n e p a r a m s
U p d a t e C W L p ro p s
58. Easy to customize our AWS resources
https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/
59. All examples are in our GitHub
https://github.com/getshifter/alexa-shifterman
60. Conclusion
• We can easy to make voice app by Alexa
• AWS help us to create & manage Alexa app
• Let’s create own Alexa Skills !