Alexa Response
Build JSON responses for Amazon Alexa, easily. Alexa Response makes use of a chainable interface to simplify building complex responses. Try it out in the Alexa Playground.
API
ask(speech: String, type: Optional<PlainText|SSML>)
Alexa can ask questions to users and will wait for their responses. The parameters passed to this function can be plain text or SSML.
Response;
say(speech: String, type: Optional<PlainText|SSML>)
This is similar to ask
except that it closes the current session. The
parameters passed to this function can be plain text or SSML.
Response;
reprompt(speech: String, type: Optional<PlainText|SSML>)
If Alexa doesn't pick up the answer to a question then the reprompt text will be used. The parameters passed to this function can be plain text or SSML.
Response ;
card(options: Object)
Cards show up in the Alexa app. Simple cards have titles and content, you can
pass an optional type
for different card types.
Response ;
attributes(data: Object)
You can maintain data across sessions using attribute data.
Response attributes question_asked: true ;
directives(directives: ...Directive)
Used to add directives to the response. A helper is provided to build an audio directive, however, any directive can be used. This function accepts multiple directives.
Response ;
build(attributes: Optional<Object>)
Responses have a chainable API, when you want to finalize the response, call
build
.
Response ;
AudioPlayer
This helper is provided to build AudioPlayer
directives.
; const play enqueue stop clearQueue = AudioPlayer; Response ;
Inline SSML
You can use SSML
directly by including babel-plugin-transform-react-jsx
in your .babelrc
and
importing ssml
from ssml-jsx
in your source file.
;; Response