deprecated

  Programmatic interface for interacting with the Bespoken Alexa emulator.
  We have moved this functionality to its own repo, Bespoken Virtual Alexa
  Please use that for new development.
  This class will be removed in future versions to be replaced by calls to that library

  Overview on usage can be found here. NodeJS tutorial here

### Hierarchy

- BSTAlexa

## Index

### Constructors

- constructor

### Properties

- DefaultIntentSchemaLocation
- DefaultSampleUtterancesLocation

### Methods

- context
- intended
- launched
- on
- once
- playbackFinished
- playbackNearlyFinished
- playbackOffset
- playbackStopped
- sessionEnded
- spoken
- start
- stop

## Constructors

### constructor

- new BSTAlexa(skillURL: string, intentSchemaFile?: string, sampleUtterancesFile?: string, applicationID?: string): BSTAlexa

- - Defined in client/bst-alexa.ts:64

  Creates a new Alexa emulator

  #### Parameters

  - ##### skillURL: string

    The URL the skill is listening that this emulator should interact with

  - ##### Optional intentSchemaFile: string

    The path to the intent schema file - defaults to BSTAlexa.DefaultIntentSchemaLocation.

  - ##### Optional sampleUtterancesFile: string

    The path to the samples utterances file - defaults to BSTAlexa.DefaultSampleUtterancesLocation.

  - ##### Optional applicationID: string

    The application ID. Just makes one up if none is defined.

  #### Returns BSTAlexa

## Properties

### Static DefaultIntentSchemaLocation

DefaultIntentSchemaLocation: string = "speechAssets/IntentSchema.json"

- Defined in client/bst-alexa.ts:62

### Static DefaultSampleUtterancesLocation

DefaultSampleUtterancesLocation: string = "speechAssets/SampleUtterances.txt"

- Defined in client/bst-alexa.ts:63

## Methods

### context

- context(): AlexaContext

- - Defined in client/bst-alexa.ts:113

  #### Returns AlexaContext

### intended

- intended(intentName: string, slots?: object, callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:212

  Emulates the specified intent coming from the Alexa device.

  #### Parameters

  - ##### intentName: string

    The name of the intent - must exactly match the IntentSchema

  - ##### Optional slots: object

    A key-value dictionary of slots in the form { "slotName": "slotValue" }

    - ##### [id: string]: string

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### launched

- launched(callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:226

  Emulates the specified skill being launched

  #### Parameters

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### on

- on(eventType: string, callback: function): BSTAlexa

- - Defined in client/bst-alexa.ts:129

  Registers a callback for Skill events

  For AudioPlayer events, the payload is an AudioItem

  For event type BSTAlexaEvents.Response, the payload is the response body as JSON A second parameter with the body of the request as JSON is also passed

  #### Parameters

  - ##### eventType: string

  - ##### callback: function

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns BSTAlexa

  Itself

### once

- once(eventType: string, callback: function): BSTAlexa

- - Defined in client/bst-alexa.ts:159

  Registers a one-time callback for Skill events

  For AudioPlayer events, the payload is an AudioItem

  For event type BSTAlexaEvents.Response, the payload is the response body as JSON A second parameter with the body of the request as JSON is also passed

  #### Parameters

  - ##### eventType: string

  - ##### callback: function

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns BSTAlexa

  Itself

### playbackFinished

- playbackFinished(callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:253

  Emulates the current track playing to completion.

  The Alexa Emulator will automatically play the next queued track as well as signal to your skill the current track has completed

  @param callback Returns any error, along the response and request JSON associated with this call @returns Itself

  #### Parameters

  - ##### Optional callback: function

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

### playbackNearlyFinished

- playbackNearlyFinished(callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:268

  Triggers a AudioPlayer.PlaybackNearlyFinished request from Alexa

  #### Parameters

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### playbackOffset

- playbackOffset(offsetInMilliseconds: number): BSTAlexa

- - Defined in client/bst-alexa.ts:299

  Emulates the track being played back

  Updates the offset time on the track

  #### Parameters

  - ##### offsetInMilliseconds: number

  #### Returns BSTAlexa

  Itself

### playbackStopped

- playbackStopped(callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:283

  Triggers a AudioPlayer.PlaybackStopped request from Alexa

  #### Parameters

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### sessionEnded

- sessionEnded(sessionEndedReason: string, callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:237

  Ends the session - requires a reason

  #### Parameters

  - ##### sessionEndedReason: string

    Can be ERROR, EXCEEDED_MAX_REPROMPTS or USER_INITIATED

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### spoken

- spoken(phrase: string, callback?: function): BSTAlexa

- - Defined in client/bst-alexa.ts:196

  Emulates the specified phrase being said to an Alexa device.

  To send an utterance that uses slots, surround the slot variables like so: {MySlotValue}

  For example, if the sample utterance was defined as:

      HelloWorld Hello world, my name is {Name}

  Then the call would be:

      alexa.spoken("Hello World, my name is {John}");

  #### Parameters

  - ##### phrase: string

  - ##### Optional callback: function

    Returns any error, along the response and request JSON associated with this call

    - - (error: any, response: any, request: any): void

      - #### Parameters

        - ##### error: any

        - ##### response: any

        - ##### request: any

        #### Returns void

  #### Returns BSTAlexa

  Itself

### start

- start(ready: function): void

- - Defined in client/bst-alexa.ts:101

  Start the emulator

  #### Parameters

  - ##### ready: function

    Passes back an error if there are any issues with initialization

    - - (error?: string): void

      - #### Parameters

        - ##### Optional error: string

        #### Returns void

### stop

- stop(onStop: function): void

- - Defined in client/bst-alexa.ts:309

  Turns off the Alexa emulator. Useful for running inside of tests to ensure all cleanup has completed before next test starts.

  #### Parameters

  - ##### onStop: function

    - - (): void

      - #### Returns void

Generated using TypeDoc