alexaResponse: Prepare a Response for Alexa

Description Usage Arguments

View source: R/response.R

Description

Form a response object that satisfies the requirements of a response to an Alexa custom skill request. All objects returned for an Alexa custom skill should be an object formed using this function.

Usage

1
alexaResponse(output, card, reprompt, attributes = NULL, endSession = FALSE)

Arguments

output

A character string containing the words Alexa should read back to the request. Converted to PlainTextSpeech in the Alexa API.

card

A list containing the contents of the card to be displayed in response to the request. See https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#card-object for more information about how the card should be structured.

reprompt

A character string representing the PlainTextSpeech to be included as the reprompt object. From the Amazon documentation: "The object containing the outputSpeech to use if a re-prompt is necessary. This is used if the your service keeps the session open after sending the response, but the user does not respond with anything that maps to an intent defined in your voice interface while the audio stream is open. If this is not set, the user is not re-prompted." https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference#response-object

attributes

A list of data to attach to this Alexa session. Subsequent requests from this session will include whatever data you provide here in the attributes field.

Note that every response must include all attributes that you wish to persist. If you return a single response of any type that doesn't include any attributes, then all attributes will be cleared from the session immediately. Thus, if you want to persist session state across requests, you'll need to carry these attributes forward through each response, by passing back the attributes on every single response.

endSession

If TRUE, will force the session to close as a result of this response.


jhudsl/alexar documentation built on May 3, 2019, 3 p.m.