Skip to content

Instantly share code, notes, and snippets.

View jkelvie's full-sized avatar

John Kelvie jkelvie

View GitHub Profile
@jkelvie
jkelvie / ecp-sample.json
Created January 18, 2022 15:40
ECP Sample Output
{
"error":"false",
"state":"play",
"plugin": {
"bandwidth":"22483196 bps",
"id":"22297",
"name":"Spotify Music"
},
"format": {
"audio":"pcm",
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.
const Alexa = require('ask-sdk-core');
const persistenceAdapter = require('ask-sdk-s3-persistence-adapter');
const launchDocument = require('./documents/launchDocument.json');
const birthdayDocument = require("./documents/birthdayDocument.json");
const util = require('./util');
{
"envelopeVersion": "20160207",
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alerts",
"version": "1.3"
},
{
"type": "AlexaInterface",
{
"streamURL": null,
"raw": {
"messageBody": {
"directives": [
{
"namespace": "SpeechRecognizer",
"payload": {},
"name": "StopCapture"
},
const virtualAlexa = require("virtual-alexa");
const expect = require("expect");
const TEST_COUNT = 100; // The number of tests to run in total
const TEST_CONCURRENCY = 20; // The number of test to run concurrently
const TEST_OFFSET = 10; // Milliseconds to offset starting each test
const TEST_START = Date.now(); // The start time for the tests as a whole
let concurrentCalls = TEST_CONCURRENCY;
let calls = 0;
@jkelvie
jkelvie / skill-sample-nodejs-fact.test.yml
Last active April 6, 2018 00:51
YAML Test Spec for Skill Sample Node.js Fact
---
configuration:
locale: en-US
---
- Test: "Test launch request" # Optional info about the test
- LaunchRequest: # LaunchRequest is "reserved" - it is interpreted not as an utterance but as a LaunchRequest
- response.outputSpeech.ssml =~ "Here's your fact: *"
- response.card.title =~ "Space Facts"
- repsonse.card.content =~ "*"
@jkelvie
jkelvie / index.js
Last active March 26, 2018 12:58
Playing Audio With The AudioPlayer
/**
* Plays a particular track, from specific offset
* @param audioURL The URL to play
* @param offsetInMilliseconds The point from which to play - we set this to something other than zero when resuming
*/
SimplePlayer.prototype.play = function (audioURL, offsetInMilliseconds) {
var response = {
version: "1.0",
response: {
shouldEndSession: true,
machine:
node:
version: 6.9.2
dependencies:
pre:
- npm install -g ask-cli
test:
override:
it("Runs through game with two players", async () => {
const virtualDevice = new vds.VirtualDevice(process.env.VIRTUAL_DEVICE_TOKEN);
await virtualDevice.message("alexa exit");
let result = await virtualDevice.message("open guess the price");
assert.include(result.transcript, "welcome to guess the price how many persons are playing today");
result = await virtualDevice.message("two");
console.log("Result: " + result.transcript);
assert.include(result.transcript, "what is your name");
app.followUpState('DescriptionState')
.showImageCard(response.name, description, response.sprites.front_default)
.ask(speech, reprompt);