defmodule LineMessage do use Application use Supervisor def start(_type, _args) do result = Supervisor.start_link(__MODULE__, :ok) handler = Application.get_env(:line_message, :handler) handler._handle_line_message result end def init(_) do HTTPotion.start Agent.start_link(fn -> Map.new end, name: EventAgent) children = [ worker(LineMessage.Event, []) ] supervise children, strategy: :one_for_one end end