elixir_wit v0.1.0 Wit.Actions

Wit.Actions is used to implement the default behaviour for the Wit which involves functions like say, merge, error. The macro defaction is also provided to define your own custom actions. When using defaction the name of the function is matched with the action returned from the converse API.

Examples

defmodule WeatherActions do
  use Wit.Actions

  def say(session, context, message) do
    # Send the message to the user
  end

  def merge(session, context, message) do
    context # Return the updated context
  end

  def error(session, context, error) do
    # Handle error
  end

  defaction fetch_weather(session, context) do
    context # Return the updated context
  end
end

Summary

Macros

Defines a wit custom action

Macros

defaction(head, list)

Defines a wit custom action

Examples

defaction fetch_weather(session, context) do
  # Fetch weather
  context # Return the updated context
end