Skip to content
SDK of the Clova CEK for Elixir
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.formatter.exs
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LEGAL_NOTICE.md
LICENSE.txt
README.md
mix.exs
mix.lock

README.md

Clova

A behaviour and related modules for implementing a Clova Extension.

Summary

Defines a Clova behaviour which can be implemented to receive callbacks to handle requests. Plug should be used to parse the request, validate it, and dispatch it to the Clova implementation.

Example Plug.Router pipeline:

plug Clova.SkillPlug,
  dispatch_to: MyExtension,
  app_id: "com.example.my_extension",
  json_module: Poison

plug :match
plug :dispatch

post "/endpoint" do
  send_resp(conn)
end

Example Clova implementation for a Hello World extension:

defmodule MyExtension do
  use Clova

  def handle_launch(_request, response) do
    response
    |> add_speech("ハロー、ワールド!")
    |> end_session
  end
end

For a more detailed example, see the AirQuality example extension.

Installation

Add :clova to your mix.exs dependencies. This package assumes you will be using Plug - see the Plug documentation for setting up a Plug application.

  defp deps do
    [
      {:clova, "~> 0.5.0"},
      {:plug, "~> 1.6"},
      {:cowboy, "~> 2.2"},
      # You can use whichever JSON library you prefer
      {:poison, "~> 3.1"}
    ]
  end

Online Documentation

Full documentation is available on HexDocs.

You can’t perform that action at this time.