To complement our proxy tool, which allows Alexa services to communicate with the source code on your machine, we have added a bst speak command to allow you to quickly test sample utterances.
bst speak provides you with the same functionality as the Service Simulator to test your skill but now contained within your console.
Get Started
First install the CLI with NPM:
$ npm install -g bespoken-tools
Or if you already have it, double check you have the latest version:
$ npm update -g bespoken-tools
(Wait, I don’t have NPM! No problem, start here first.)
Next, make sure you have a proxy running. For example if you are working on a Node.js Lambda:
$ bst proxy lambda src/index.js
Now, use the speak command by passing your intent schema, sample utterances file, and the utterance to test:
$ bst speak -i speechAssets/IntentSchema.json -s speechAssets/Utterances.txt {utterance}
Alternatively, if your speech assets are at the following relative paths, ./speechAssets/IntentSchema.json
and ./speechAssets/SampleUtterances.txt
, you do not need to include them as parameters like above. This simplifies the command to:
$ bst speak {utterance}
So for example, if I wanted to test the utterance “hello”:
$ bst speak -i speechAssets/IntentSchema.json -s speechAssets/Utterances.txt hello
Entering this command will return the request payload:
{
"session":{
"sessionId":"SessionID.0f46d04a-3912-41fc-8dab-6f0b6adcbac6",
"application":{
"applicationId":"amzn1.echo-sdk-ams.app.3235a2c2-95e1-4afd-88af-7fe2ce310c4d"
},
"attributes":{},
"user":{
"userId":"amzn1.ask.account.beccf1d7-d400-4a4e-9d40-de682ba95e67"
},
"new":true
},
"version":"1.0",
"request":{
"type":"IntentRequest",
"requestId":"EdwRequestId.e1c37ee0-0613-412b-8403-9628ffddec36",
"locale":"en-US",
"timestamp":"2016-09-23T20:58:50Z",
"intent":{
"name":"HelloWorldIntent",
"slots":{}
}
}
}
And the response payload:
{
"version":"1.0",
"response":{
"outputSpeech":{
"type":"SSML",
"ssml":"<speak> Hello World! </speak>"
},
"shouldEndSession":true
},
"sessionAttributes":{}
}
Thats it! If you want to go in to more depth, check out the docs.