Announcing Juvet

Working towards a more familiar chat bot framework

I have been a fan of chat bots for quite a while, going back to the Campfire days when I built my first plugin. Since then I have been hooked. I have been talking about chat bots, building chat bots, and providing tools for others to build chat bots.

Chat bots are important. They are important to the consumer because they are familiar (you know how to text) and they are easy to access (you already have the software). Chat bots are important to developers and entrepreneurs because they can extend your services and offerings to platforms where the customers already are.

Developers need more familiar tooling for building chat bots.

Today I would like to announce Juvet, an MVC framework for building chat bots written in Elixir. Its aim is to make the building of chat bots as familiar as building web applications.

We have amazing tools to build web applications productively. The goal of Juvet is to borrow this same approach and help developers with building chat bots for platforms like Slack, Microsoft Teams, SMS, and more using familiar patterns.

MVC, you say?

If you look at how chat bots work, you will see that you have a very familiar pattern.

A conversation request is received from a chat bot platform endpoint (i.e. Slack). Then you, as the developer, process that request within your code, and send back a response to that endpoint.

Sound’s familiar, right?

The model-view-controller (MVC) pattern that is used in so many of the popular web frameworks today like Rails, Django, and Laravel, can be adopted to process conversational UIs from chat bots in a similar way.

This MVC architecture and the organization of code helps developers reason about the system as a whole.

As a freelancer, I have seen a lot of hard to understand code around the handling of chat bot requests. The request handler is often tied into the same code applying business logic to process the request. A good framework will remove this intertwined dependency from the code that matters to the business. As an early developer in this space, I have built my fair share of code like this.

However, I recently built a similar MVC framework in Ruby for a chat bot client. The framework I built helped facilitate nimble iterative feature releases and quick bug fixes. I have been a much happier developer working in this familiar framework.

From this experience, I know that a system like this excels in the real world.

Juvet will have all the familiar pieces of an MVC framework that you have grown to love, like a router to route requests from a chat bot framework.

defmodule Router do
  use Juvet.Router

  platform :slack do
    command("/task", TaskController, :new)

    action("delete_task", TaskController, :delete)

    event("app_home_opened", HomeController, :show)

    view_submission("create_task", TaskController, :create)
  end
end

A controller and action in Juvet will handle the incoming requests and prepare the data for the response.

defmodule TaskController do
  use Juvet.Controller

  def new(_bot, %{ team_id: team_id } = params)
    tags = Tag.find_by_team_id(team_id)

    render(:modal, "new.json", %{ tags: tags })
  end
end

A view template will be used to describe what the user will see on their chat bot platform.

template do
  title "Create a New Task"
  callback_id :create_task

  blocks do
    section do
      text "Track your work with tasks."
    end

    divider

    plain_text_input do
      block_id :title
      label "Title"
      hint "A short description of your task"
      optional false
      placeholder "Get milk"
    end

    plain_text_input do
      block_id :description
      label "Description"
      multiline: true
      optional true
      placeholder " "
    end

    checkboxes_input do
      label "Tags"
      options do
        for tag <- tags do
          text tag.name
          value tag.id
        end
      end
    end
  end

  submit "Save Task"
end

The result is a beautifully crafted response that the user sees inside Slack.

Slack modal

Why Elixir?

Elixir is the perfect language and framework for building chat bots.

First, Elixir runs on top of the Erlang virtual machine. Erlang was developed at Ericsson to handle communication systems. 90% of all internet traffic going through routers and switches controlled by Erlang.

Sounds perfect.

Erlang is used to build massively scalable soft real-time systems with requirements on high availability. Scalable real-time systems? High availability?

Sounds like chat bots.

Elixir can leverage the Erlang OTP library, which is a set of libraries which facilitate the scalability and fault tolerance properties of Erlang.

Elixir developers can create small OTP processes that can hold state and these sandboxed processes can pass messages to other processes with no ceremony. Each process can represent a single sandboxed chat bot. If one process goes down, only one chat bot goes down. This is not possible in frameworks built in Ruby or Node without a lot of home-spun code to protect you from bringing down all the bots on your system.

These OTP processes can fail and be spun up again automagically. Even new code can be deployed and these OTP processes will not be shut down, allowing you to deploy new Elixir code at any time without interrupting the bots.

Sounds perfect.

You can support this

Juvet will be open source so that every developer and organization can take advantage of this framework to help develop for multiple chat bot platforms rapidly.

I want the development on this framework to be sustainable for me as I plan on putting a lot of energy and effort into this project alongside my day to day work.

Currently Juvet is being developed under the Sponsorware release strategy for open source. The project is open only to GitHub sponsors until the goal of 75 sponsors is reached. At that time, Juvet will be open sourced for all.

If you are an early sponsor, you will help direct the project as you will have full access to the unreleased private repository where you can submit pull requests and open up issues. In addition, you will be able receive updates on the progress of the project, video tutorials on how to use Juvet, tips on chat bot development, and a few special surprises I have in mind.

If you care about the chat bot industry or if you are interested in building chat bots for yourself or your organization, please consider supporting this endevor by sponsoring me on GitHub. I’d love to thank Keith on being my very first sponsor on GitHub. 😍

My hope is that Juvet will be my little dent in the chat bot development world. I hope it helps moves more developers to build such fun little programs.

← Back to all posts
© 2020 Brilliant Fantastic