Clova v0.2.1 Clova behaviour View Source

A behaviour for Clova extentions.

An implementation of this behaviour should be specified as the argument to the Clova.Dispatcher plug:

plug Clova.Dispatcher, dispatch_to: MyExtension

Each callback is called with a Clova.Request and Clova.Response struct. Helpers exist on those modules to extract data from the request and add data to the response. The callbacks should return the completed response struct, which will be added to the Plug.Conn struct by Clova.Dispatcher.

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

Link to this callback handle_intent(name, request, response) View Source
handle_intent(
  name :: String.t(),
  request :: Clova.Request.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.

Link to this callback handle_launch(request, response) View Source
handle_launch(request :: Clova.Request.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.

Link to this callback handle_session_ended(request, response) View Source
handle_session_ended(
  request :: Clova.Request.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.