Clova v0.5.0 Clova behaviour View Source
A behaviour for Clova extentions.
An implementation of this behaviour will be called by the Clova.DispatcherPlug
.
Each callback is called with a map representing the decoded clova request, and a struct representing the
clova response. Helpers from the Clova.Request
and Clova.Response
modules for reading the request
and manipulating the response are imported by default. The callbacks should return the completed response
struct, which will be added to the Plug.Conn
struct by Clova.DispatcherPlug
.
Link to this section Summary
Callbacks
Called when an IntentRequest
is received
Called when a LaunchRequest
is received
Called when a SessionEndedRequest
is received
Link to this section Callbacks
handle_intent( name :: String.t(), request :: Map.t(), response :: Clova.Response.t() ) :: Clova.Response.t()
Called when an IntentRequest
is received.
The name of the intent is extracted and passed as the name
argument,
to allow for easier pattern matching. Clova.Request.get_slot/2
can be used to retrieve
the slot data for an intent.
The response
parameter is an empty response which can be used with the functions
in Clova.Response
in order to produce a completed response to return.
handle_launch(request :: Map.t(), response :: Clova.Response.t()) :: Clova.Response.t()
Called when a LaunchRequest
is received.
The response
parameter is an empty response which can be used with the functions
in Clova.Response
in order to produce a completed response to return.
handle_session_ended(request :: Map.t(), response :: Clova.Response.t()) :: Clova.Response.t()
Called when a SessionEndedRequest
is received.
The response
parameter is an empty response which can be used with the functions
in Clova.Response
in order to produce a completed response to return. At the time of writing
any response to a SessionEndedRequest
is ignored by the server.