public interface Speechlet
A Speechlet is a speech-enabled web service that runs in the cloud. A Speechlet
receives and responds to speech initiated requests.
The methods in the Speechlet interface define:
Because a Speechlet is a cloud-based service, the life-cycle of the actual object
implementing the Speechlet interface is unrelated to the life-cycle of the Alexa skill as
experienced by the user interacting with the speech enabled device. A single Speechlet
object typically handles requests from many users, from many devices, for many sessions, using
many concurrent threads. Also, multiple requests that are part of a single session coming from a
single user and a single device may actually be serviced by different Speechlet objects
if your service is deployed on multiple machines and load-balanced. The Session object is
what defines a single run of a skill as experienced by a user.
Session,
SpeechletException| Modifier and Type | Method and Description |
|---|---|
SpeechletResponse |
onIntent(IntentRequest request,
Session session)
Entry point for handling speech initiated requests.
This is where the bulk of the Speechlet logic lives. |
SpeechletResponse |
onLaunch(LaunchRequest request,
Session session)
Entry point for
Speechlets for handling a speech initiated request to start the skill
without providing an Intent.This method is only invoked when Session.isNew() is true. |
void |
onSessionEnded(SessionEndedRequest request,
Session session)
Callback used to notify that the session ended as a result of the user interacting, or not
interacting with the device.
|
void |
onSessionStarted(SessionStartedRequest request,
Session session)
Used to notify that a new session started as a result of a user interacting with the device.
|
void onSessionStarted(SessionStartedRequest request, Session session) throws SpeechletException
Speechlets to perform initialization logic and allows for session
attributes to be stored for subsequent requests.request - the session started requestsession - the session associated with the user starting a SpeechletSpeechletException - for any errors encountered in the processing of the requestSpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException
Speechlets for handling a speech initiated request to start the skill
without providing an Intent.Session.isNew() is true.request - the launch requestsession - the session associated with the requestSpeechletException - for any errors encountered in the processing of the requestSpeechletResponse onIntent(IntentRequest request, Session session) throws SpeechletException
Speechlet logic lives. Intent requests are handled by
this method and return responses to render to the user.Speechlet session, Session.isNew()
returns true. Otherwise, this is a subsequent request within an existing session.request - the intent request to handlesession - the session associated with the requestSpeechletException - for any errors encountered in the processing of the requestvoid onSessionEnded(SessionEndedRequest request, Session session) throws SpeechletException
Speechlet itself ended
the session using SpeechletResponse.setShouldEndSession(boolean).request - the end of session requestsession - the session associated with the requestSpeechletException - for any errors encountered in the processing of the requestCopyright © 2016. All rights reserved.