Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResponseBuilder

An interface which helps building a response.

Hierarchy

  • ResponseBuilder

Index

Constructors

constructor

Properties

_responseObject

_responseObject: ResponseEnvelope

Protected responseHelper

responseHelper: ResponseHelper

Methods

_addDirective

  • _addDirective(directive: Directive): this

addAudioPlayerClearQueueDirective

  • addAudioPlayerClearQueueDirective(clearBehavior: interfaces.audioplayer.ClearBehavior): this
  • Adds an AudioPlayer ClearQueue directive - clear the queue without stopping the currently playing stream, or clear the queue and stop any currently playing stream.

    Parameters

    • clearBehavior: interfaces.audioplayer.ClearBehavior

      Describes the clear queue behavior. Accepted values: CLEAR_ENQUEUED: clears the queue and continues to play the currently playing stream CLEAR_ALL: clears the entire playback queue and stops the currently playing stream (if applicable).

    Returns this

addAudioPlayerPlayDirective

  • addAudioPlayerPlayDirective(playBehavior: interfaces.audioplayer.PlayBehavior, url: string, token: string, offsetInMilliseconds: number, expectedPreviousToken?: string, audioItemMetadata?: AudioItemMetadata): this
  • Adds an AudioPlayer play directive

    Parameters

    • playBehavior: interfaces.audioplayer.PlayBehavior

      Describes playback behavior. Accepted values: REPLACE_ALL: Immediately begin playback of the specified stream, and replace current and enqueued streams. ENQUEUE: Add the specified stream to the end of the current queue. This does not impact the currently playing stream. REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream.

    • url: string

      Identifies the location of audio content at a remote HTTPS location. The audio file must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the files must present a valid, trusted SSL certificate. Self-signed certificates cannot be used. The supported formats for the audio file include AAC/MP4, MP3, HLS, PLS and M3U. Bitrates: 16kbps to 384 kbps.

    • token: string

      A token that represents the audio stream. This token cannot exceed 1024 characters

    • offsetInMilliseconds: number

      The timestamp in the stream from which Alexa should begin playback. Set to 0 to start playing the stream from the beginning. Set to any other value to start playback from that associated point in the stream

    • Optional expectedPreviousToken: string

      A token that represents the expected previous stream. This property is required and allowed only when the playBehavior is ENQUEUE. This is used to prevent potential race conditions if requests to progress through a playlist and change tracks occur at the same time.

    • Optional audioItemMetadata: AudioItemMetadata

      Metadata that can be displayed on screen enabled devices

    Returns this

addAudioPlayerStopDirective

  • addAudioPlayerStopDirective(): this

addConfirmIntentDirective

  • addConfirmIntentDirective(updatedIntent?: Intent): this

addConfirmSlotDirective

  • addConfirmSlotDirective(slotToConfirm: string, updatedIntent?: Intent): this

addDelegateDirective

  • addDelegateDirective(updatedIntent?: Intent): this

addDirective

  • addDirective(directive: Directive): this

addElicitSlotDirective

  • addElicitSlotDirective(slotToElicit: string, updatedIntent?: Intent): this

addHintDirective

  • addHintDirective(text: string): this

addRenderTemplateDirective

  • addRenderTemplateDirective(template: interfaces.display.Template): this

addVideoAppLaunchDirective

  • addVideoAppLaunchDirective(source: string, title?: string, subtitle?: string): this
  • Adds a VideoApp play directive to play a video

    Parameters

    • source: string

      Identifies the location of video content at a remote HTTPS location. The video file must be hosted at an Internet-accessible HTTPS endpoint.

    • Optional title: string

      (optional) title that can be displayed on VideoApp.

    • Optional subtitle: string

      (optional) subtitle that can be displayed on VideoApp.

    Returns this

askForPermissionsConsentCard

  • askForPermissionsConsentCard(permissions: string[]): this

audioPlayerClearQueue

  • audioPlayerClearQueue(clearBehavior: interfaces.audioplayer.ClearBehavior): this

audioPlayerPlay

  • audioPlayerPlay(behavior: interfaces.audioplayer.PlayBehavior, url: string, audioToken: string, expectedPreviousToken: string, offsetInMilliseconds: number): this

audioPlayerStop

  • audioPlayerStop(): this

cardRenderer

  • cardRenderer(cardTitle: string, cardContent: string, cardImage?: object): this

confirmIntent

  • confirmIntent(updatedIntent: Intent): this

confirmSlot

  • confirmSlot(slotName: string, updatedIntent?: Intent): this

delegate

  • delegate(intent: Intent): this

elicitSlot

  • elicitSlot(slotName: string, updatedIntent: Intent): this

getResponse

  • getResponse(): Response

hint

  • hint(hintText: string): this

linkAccountCard

  • linkAccountCard(): this

listen

  • listen(repromptSpeechOutput: string): this

playVideo

  • playVideo(source: string, metadata?: object): this

renderTemplate

  • renderTemplate(template: interfaces.display.Template): this

reprompt

  • reprompt(repromptSpeechOutput: string, playBehavior?: ui.PlayBehavior): this
  • Has alexa listen for speech from the user. If the user doesn't respond within 8 seconds then has alexa reprompt with the provided reprompt speech

    Parameters

    • repromptSpeechOutput: string
    • Optional playBehavior: ui.PlayBehavior

    Returns this

shouldEndSession

  • shouldEndSession(val: boolean): this

speak

  • speak(speechOutput: string, playBehavior?: ui.PlayBehavior): this

withAskForPermissionsConsentCard

  • withAskForPermissionsConsentCard(permissionArray: string[]): this

withCanFulfillIntent

  • withCanFulfillIntent(canFulfillIntent: CanFulfillIntent): this

withLinkAccountCard

  • withLinkAccountCard(): this

withShouldEndSession

  • withShouldEndSession(val: boolean): this

withSimpleCard

  • withSimpleCard(cardTitle: string, cardContent: string): this

withStandardCard

  • withStandardCard(cardTitle: string, cardContent: string, smallImageUrl?: string, largeImageUrl?: string): this
  • Renders a standard card with the following title, content and image

    Parameters

    • cardTitle: string
    • cardContent: string
    • Optional smallImageUrl: string
    • Optional largeImageUrl: string

    Returns this