All Projects β†’ bespoken β†’ Virtual Alexa

bespoken / Virtual Alexa

Licence: apache-2.0
πŸ€– Easily test and debug Alexa skills programmatically

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Virtual Alexa

Depressionai
Alexa skill for people suffering with depression.
Stars: ✭ 92 (-13.21%)
Mutual labels:  alexa, alexa-skills-kit
ask-console-chrome-extension
⚑️ Chrome Extension for faster testing in the Alexa Skill Simulator
Stars: ✭ 37 (-65.09%)
Mutual labels:  alexa, alexa-skills-kit
Azure4Alexa
Create and Host Alexa Custom Skills using .NET and Azure
Stars: ✭ 48 (-54.72%)
Mutual labels:  alexa, alexa-skills-kit
alexa-ruby
Ruby toolkit for Amazon Alexa service
Stars: ✭ 17 (-83.96%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Smarthome
Resources for Alexa Smart Home developers.
Stars: ✭ 496 (+367.92%)
Mutual labels:  alexa, alexa-skills-kit
alexa-skills-kit-golang
GoLang port of the Amazon Alexa Skills Kit
Stars: ✭ 48 (-54.72%)
Mutual labels:  alexa, alexa-skills-kit
serverless-alexa-skills
Manage your Alexa Skills with Serverless Framework
Stars: ✭ 69 (-34.91%)
Mutual labels:  alexa, alexa-skills-kit
Bst
πŸ”§ Bespoken Tools - Tools for making voice apps faster and better
Stars: ✭ 193 (+82.08%)
Mutual labels:  alexa, alexa-skills-kit
Awesome Amazon Alexa
πŸ—£Curated list of awesome resources for the Amazon Alexa platform.
Stars: ✭ 458 (+332.08%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Skill Kit
Library for effortless Alexa Skill development with AWS Lambda
Stars: ✭ 278 (+162.26%)
Mutual labels:  alexa, alexa-skills-kit
ask-toolkit-for-vscode
ASK Toolkit is an extension for Visual Studio Code (VSC) that that makes it easier for developers to develop and deploy Alexa Skills.
Stars: ✭ 90 (-15.09%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Skills Kit Sdk For Java
The Alexa Skills Kit SDK for Java helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 758 (+615.09%)
Mutual labels:  alexa, alexa-skills-kit
amazon-alexa-skill-library
DEPRECATED PHP Library for Amazon Alexa Skills
Stars: ✭ 13 (-87.74%)
Mutual labels:  alexa, alexa-skills-kit
alexa-skill-test-framework
Framework for easy offline black-box testing of Alexa skills.
Stars: ✭ 64 (-39.62%)
Mutual labels:  alexa, alexa-skills-kit
Awesome Bots
The most awesome list about bots β­οΈπŸ€–
Stars: ✭ 2,864 (+2601.89%)
Mutual labels:  alexa, alexa-skills-kit
cookiecutter-flask-ask
Cookiecutter template for Alexa skills based on the fantastic Flask-Ask framework πŸΎπŸ—£β“
Stars: ✭ 51 (-51.89%)
Mutual labels:  alexa, alexa-skills-kit
Flask Ask
Alexa Skills Kit for Python
Stars: ✭ 1,877 (+1670.75%)
Mutual labels:  alexa, alexa-skills-kit
Alexaskillskit
Swift library to develop custom Alexa Skills
Stars: ✭ 160 (+50.94%)
Mutual labels:  alexa, alexa-skills-kit
alexa-apis-for-python
The Alexa APIs for Python consists of python classes that represent the request and response JSON of Alexa services. These models act as core dependency for the Alexa Skills Kit Python SDK (https://github.com/alexa/alexa-skills-kit-sdk-for-python).
Stars: ✭ 82 (-22.64%)
Mutual labels:  alexa, alexa-skills-kit
Alexa Skills Kit Sdk For Python
The Alexa Skills Kit SDK for Python helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Stars: ✭ 678 (+539.62%)
Mutual labels:  alexa, alexa-skills-kit

Bespoken

Virtual Alexa
Interact with skills intuitively and programmatically.

Build Status Codecov NPM Version Docs Gitter

Virtual Alexa

Virtual Alexa allows for interacting with skills programmatically.

The core Virtual Alexa API provides several routines - the three most essential ones:

* launch: Generates JSON for a launch request
* intend: Generates JSON as if the given intent was uttered  
* utter: Generates JSON as if the user said the given phrase  

And also check out our YAML Test Scripts. They allow for:

  • End-to-end Testing (using our virtual devices)
  • SMAPI Simulation-Based Testing (using the Skill Management API)
  • Unit-Testing (using this library)

All via our simple, readable YAML syntax. Read more here.

What's New In The Latest Version (0.7.x)

Why Do I Need This?

This library allows for easy testing of skills.

You can use it for:

  1. Unit-testing - ensuring individual routines work correctly
  2. Regression testing - ensuring the code as a whole works properly

How Do I Get It?

npm install virtual-alexa --save-dev

How Do I Use It?

Easy! Just add a line of code like so:

const va = require("virtual-alexa");
const alexa = va.VirtualAlexa.Builder()
    .handler("index.handler") // Lambda function file and name
    .interactionModelFile("./models/en-US.json") // Path to interaction model file
    .create();

alexa.intend("PlayIntent").then((payload) => {
    console.log("OutputSpeech: " + payload.response.outputSpeech.ssml);
    // Prints out returned SSML, e.g., "<speak> Welcome to my Skill </speak>"
});

Our "canonical" full example is the Super Simple Unit Testing project.

Virtual Alexa With Async/Await

Here are some basic tests that uses async/await:

it("Accepts responses without dollars", async function () {
    const alexa = bvd.VirtualAlexa.Builder()
        .handler("index.handler") // Lambda function file and name
        .intentSchemaFile("./speechAssets/IntentSchema.json") // Uses old-style intent schema
        .sampleUtterancesFile("./speechAssets/SampleUtterances.txt")
        .create();

    const launchResponse = await alexa.launch();
    assert.include(launchResponse.response.outputSpeech.ssml, "Welcome to guess the price");

    const playerOneResponse = await alexa.intend("NumberIntent", { number: "2" });
    assert.include(playerOneResponse.response.outputSpeech.ssml, "what is your name");
    assert.include(playerOneResponse.response.outputSpeech.ssml, "contestant one");

    const playerTwoResponse = await alexa.intend("NameIntent", { name: "john" });
    assert.include(playerTwoResponse.response.outputSpeech.ssml, "what is your name");
    assert.include(playerTwoResponse.response.outputSpeech.ssml, "Contestant 2");

    const gameStartResponse =  await alexa.intend("NameIntent", { name: "juan" });
    assert.include(gameStartResponse.response.outputSpeech.ssml, "let's start the game");
    assert.include(gameStartResponse.response.outputSpeech.ssml, "Guess the price");

    const priceGuessResponse = await alexa.intend("NumberIntent", { number: "200" });
    assert.include(priceGuessResponse.response.outputSpeech.ssml, "the actual price was");
});

This one is using Mocha (and Babel) - you can see the full example here:
https://github.com/bespoken/GuessThePrice/blob/ProgrammaticTests/test/index-test.js

Virtual Alexa With Promises

Here's an example using promises:

test("Plays once", (done) => {
    alexa.intend("GetStartedIntent").then((payload) => {
        expect(payload.response.outputSpeech.ssml).toContain("What is the search term for it");
        return alexa.intend("IncorrectGuessIntent");

    }).then((payload) => {
        expect(payload.response.outputSpeech.ssml).toContain("Nice try");
        return alexa.intend("IncorrectGuessIntent");

    }).then((payload) => {
        expect(payload.response.outputSpeech.ssml).toContain("That is not correct");
        return alexa.intend("IncorrectGuessIntent");

    }).then((payload) => {
        expect(payload.response.outputSpeech.ssml).toContain("Goodbye");
        done();

    });
});

You can see the full example this is taken from here:
https://github.com/bespoken/giftionary/blob/master/test/index.test.js

And read all the docs here:
https://bespoken.github.io/virtual-alexa/api/

Using The Request Filter

The filter is a powerful tool for manipulating the request payloads that are made to your Alexa skill.

alexa.filter((requestJSON) => {
  // Do something with the request
  requestJSON.request.locale = "en-US" // Arbitrary example of changing the request payload
});

More info on using it here.

Using the request builder:

Our request builder allows for fine-tuning requests with ease.

To use it, make a call to Virtual Alexa like so:

// Construct the request

const request = alexa.request()
    .intent("MyIntentName")
    .slot("SlotName", "SlotValue")
    .dialogState("COMPLETED")
    // Directly set any property on the JSON easily with the new set method
    .set("context.System.user.permissions.consentToken", "<TOKEN>")
    .set("context.System.device.deviceId", "<MY_DEVICE_ID>");

const response = await request.send();

Read more here.

AudioPlayer Interface

We also support the AudioPlayer! Read more here.

Display Interface

We also support the Display Interface! Read more here.

Dialog Interface

We also support the Dialog Interface. Read more here.

Using our implementation, you can simulate different payloads coming from the Dialog Manager with ease.

In-Skill Purchase Responses

You can emulate responses from an In-Skill Purchase with the following request type:

const request = alexa.request().inSkillPurchaseResponse(
    "Buy",
    "ACCEPTED",
    "MyProductId",
    "MyToken"
);

const response = await request.send();

Mocking External Calls (Dynamo and Address API)

We also support mocking external calls, such as ones made to the Address API and Dynamo. Read more here.

This allows for testing without relying on the actual calls, which are difficult if not impossible to configure for unit tests.

Entity Resolution

We support the entity resolution request payloads.

Using Virtual Alexa, we will automatically add entity resolution information to your slots, based on the your interaction model. It's like magic :-)

Read more here.

How Do I Talk To You?

Easy, find us on our Gitter or email [email protected].

We look forward to hearing from you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].