This is our first posts about ask-utils.dev.We can get information about how to make your Alexa skill more easily.
What about ask-utils?
ask-utils is the utility function library for ask-sdk to create a Alexa custom skill.
Install
$ npm i -S ask-sdk ask-utils
Before ask-utils
import { getRequestType } from 'ask-sdk'
const LaunchRequestHandler = {
canHandle (handlerInput) {
return getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest'
},
handle (handlerInput) {
const speechText = 'This is example skill'
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.withSimpleCard(SKILL_NAME, speechText)
.getResponse()
}
}
After ask-utils
import { isLaunchReques } from 'ask-utils'
const LaunchRequestHandler = {
canHandle (handlerInput) {
return isLaunchRequest(handlerInput)
},
handle (handlerInput) {
const speechText = 'This is example skill'
return handlerInput.responseBuilder
.speak(speechText)
.reprompt(speechText)
.withSimpleCard(SKILL_NAME, speechText)
.getResponse()
}
}
Features
- Make random message
- Persistant attribute manager helper
- Resolve slot value
- Provide a Interceptor
Blogs
- Get Random message by getRandomMessage() function from ask-utilsgetRandomeMessage() provides you to get the randomized message. Let’s make your skill more engaging. Alexa team told us to make our skill interactions more natural and conversational.-> Alexa Skill Recipe: Randomize Your Responses to Add Variety to Your Skill And the blog post tell us the example code to get the randomized message. ask-utils provides simple…
- Version 3.4.0: Add a new library for JSX Speech ScriptWe’re happy to announce the new package @ask-utils/speech-script.We can easy to write your Skill’s SSML like React. Install $ npm i -S @ask-utils/speech-script Usage