1.9.3 • Published 8 months ago

virtual-device-sdk v1.9.3

Weekly downloads
1,244
License
Apache 2.0
Repository
github
Last release
8 months ago

CircleCI codecov npm

Virtual Device SDK

Use the Virtual Device SDK to test Alexa without using our voice.

The SDK can be used via NodeJS or HTTP.

NodeJS SDK

Installation

Add the Virtual Device SDK to your project:

npm install virtual-device-sdk --save

Get your token:

  • Sign into the Bespoken Dashboard
  • Create a source
  • Select the Validation tab and follow the instructions there

Save the token that is generated - you will use it in the step below.

Sending a Message

Here is a simple example in Javascript:

const vdSDK = require("virtual-device-sdk");
const virtualDevice = new vdSDK.VirtualDevice("<PUT_YOUR_TOKEN_HERE>");
virtualDevice.message(message).then((result) => {
    console.log("Reply Transcript: " + result.transcript);
    console.log("Reply Audio: " + result.transcript_audio_url);
});

Result Payload

Here is the full result payload:

export interface IVirtualDeviceResult {
    card: ICard | null;
    debug?: {
        rawJSON: any;
    };
    sessionTimeout: number;
    streamURL: string | null;
    transcript: string;
    transcriptAudioURL: string;
}

export interface ICard {
    imageURL: string | null;
    mainTitle: string | null;
    subTitle: string | null;
    textField: string;
    type: string;
}

HTTP SDK

The VirtualDevice service can also be called directly via HTTP.

To use it, first get your token:

  • Sign into the Bespoken Dashboard
  • Create a source
  • Select the Validation tab and follow the instructions there

Save the token that is generated - you will use it in the step below.

Requests

The Base URL is:
https://virtual-device.bespoken.io

  • /process
    • Method: GET
    • Parameters:
      • user_id: string - VirtualDevice token
      • message: string - The message to send to VirtualDevice
      • debug: string Optional - If set, returns debug output
    • Response:

Example

HTTP Request:

https://virtual-device.bespoken.io/process
    ?user_id=<TOKEN>
    &message=hello there

HTTP Response:

{
    "card": null,
    "sessionTimeout": 0,
    "streamURL": null,
    "transcript": "hi",
    "transcriptAudioURL": "https://storage.googleapis.com/raw_audio/7898e6fb-2d3d-4039-9b4a-00641fa1c249.mp3"
}

What's Next

  • Keep the session open longer for deep skill interactions
  • Support for additional languages, platforms and locales - as well as a new Premium tier
1.9.5

8 months ago

1.9.4

8 months ago

1.9.3

1 year ago

1.9.2

1 year ago

1.9.1

2 years ago

1.9.0

2 years ago

1.8.4

2 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.5

4 years ago

1.7.4

4 years ago

1.7.3-0

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.2-0

4 years ago

1.7.1-0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.4

5 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.5.22

5 years ago

1.5.21

5 years ago

1.5.20

5 years ago

1.5.19

5 years ago

1.5.18

5 years ago

1.5.17

5 years ago

1.5.16

5 years ago

1.5.15

5 years ago

1.5.14

5 years ago

1.5.13

5 years ago

1.5.12

5 years ago

1.5.11

5 years ago

1.5.10

5 years ago

1.5.9

5 years ago

1.5.8

5 years ago

1.5.7

5 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.10

6 years ago

1.4.9

6 years ago

1.4.8

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.4.1-0

6 years ago

1.4.0-0

6 years ago

1.3.4-0

6 years ago

1.3.3-0

6 years ago

1.3.2-0

6 years ago

1.3.1-0

6 years ago

1.3.0-0

6 years ago

1.2.3-0

6 years ago

1.2.2-0

6 years ago

1.2.1-0

6 years ago

1.2.0-0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago