Sample Usage of Clova CEK SDK for Elixir
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
test
.formatter.exs
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LEGAL_NOTICE.md
LICENSE.txt
README.md
elixir_buildpack.config
mix.exs
mix.lock

README.md

AirQuality

Example Clova Extension using the Clova SDK.

Router definition

The router uses a series of plugs, and simply returns the connection object.

  plug Plug.Parsers,
    parsers: [:json],
    json_decoder: Poison,
    body_reader: Clova.CachingBodyReader.spec()
  plug Clova.Validator, app_id: "com.line-apps.air_quality"
  plug Clova.Dispatcher, dispatch_to: AirQuality
  plug :match
  plug :dispatch

  post "/clova" do
    send_resp(conn)
  end

Callback implementation

The main Clova behaviour is implemented by the AirQuality module.

  def handle_launch(_request, response) do
    response
    |> add_speech("大気汚染を知りたい都市名を言ってください")
    |> add_reprompt("都市の名前を言ったら大気汚染情報を調べますよ")
  end