Automaton 


Note: This library is still under heavy development.
Automaton is an Elixir library that manages the conversation between your chat bot and the user by maintaining the messages and context in a GenServer.
This is useful as most messaging platforms (webhooks) and NLP services (REST API) communicates with your backend in the typical Request/Response mode.
Automaton aims to be the glue/framework/library to help you focus on your backend instead of messing around with the plumbing of maintaining chat bots.
Quick Start
# In your config/config.exs file
config :sample, Sample.Bot,
adapter: Automaton.Console.Adapter
# In your application code
# Define your bot
defmodule Sample.Bot do
use Automaton.Bot, otp_app: :sample
# Echo backs whatever you said
def process(sender_id, message, context) do
reply(sender_id, message, context)
end
end
# In an IEx session
iex> Sample.Bot.converse("Hello World")
Hello World
:okInstallation
Add Automaton in your mix.exs dependencies:
def deps do
[{:automaton, "~> 0.1.0"}]
endAdapters
Platform | Automaton adapter :-----------------| :------------------------ Facebook Messenger| Automaton.FacebookMessenger.Adapter Telegram | Automaton.Telegram.Adapter Slack | Automaton.Slack.Adapter Console (Included)| Automaton.Console.Adapter
Configure your adapter in config/config.exs file:
config :sample, Sample.Bot,
adapter: Automaton.FacebookMessenger.Adapter
# adapter config (api keys, etc.)You can also define custom adapters by implementing callbacks defined in adapter.ex
Proposed Roadmap
- Stores conversation message and context
- Adapter layer to support different messaging platforms
- Simple callback to process messages/context
- Terminates stale conversation and logs it
- Callback for conversation termination for custom behavior
- Tracks simple metrics like conversation/messages counts
Documentation
More documentation can be found on hexdocs. You can also find it in the source and it's accessible from iex.
License
Plug source code is released under MIT License. Check LICENSE file for more information.