Kogno is an open source framework running on the Ruby programming language for developing conversational applications.
It is based on the MVC architecture and strongly inspired by Rails, so if you have ever worked on this framework, Kogno will be very familiar to you.
The following messaging platforms are currently supported: WhatsApp, Messenger and Telegram, maintaining a unified code in a single application for all of them.
You can read the full documentation at https://docs.kogno.io or just continue here.
$ gem install kogno
$ kogno new my_chatbot
The MySQL development libraries must be previously installed before running the following command.
$ bundle install
adapter: mysql2
pool: 5
username: your_user_name
password: your_password
host: localhost
database: your_database_name
encoding: utf8mb4
collation: utf8mb4_unicode_ci
$ kogno install
6. Start your web server to receive incoming updates via an outgoing webhook from the messaging platforms:
$ kogno http start
The code below represents a Context
class, which is the equivalent of a Controller
class in Ruby on Rails:
class MainContext < Conversation
def blocks
intent "greeting" do
@reply.text "Hello!"
@reply.button(
"How can I help you today?",
[
{
title: "View Products",
payload: "featured_products"
},
{
title: "My Cart",
payload: "purchases/view_cart"
}
]
)
end
postback "featured_products" do
@reply.text "Alright."
@reply.template "products/featured", title: "Here is a list of today's featured products."
end
keyword ["stop", "quit"] do
@reply.text "Alright"
@reply.typing 2.seconds
@reply.text "I'll stop writing you now.."
end
everything_else do
@reply.text "Sorry, but I don't understand what you said."
end
end
end
In the example above, MainContext
has the ability to handle the following scenarios:
intent "greeting"
: A greeting message such as "Hello" or "Hi". Which was previously created and trained on the NLP engine.postback"featured_products"
: Click event on the button "View Products" that have been sent as reply in the previous block intent "greeting".keyword ["stop", "quit"]
: Specifically two keywords "stop" or "quit".everything_else
: Any message whose characteristics didn't match the execution criteria of the blocks listed above.
To better understand how blocks work and to see the full list of them, check the following link https://docs.kogno.io/contexts/blocks.
You can contribute a lot to this project by developing conversational applications with Kogno and in case you find a bug, please report it.
And if you're as passionate about it as we are, come and code with us by fixing bugs, adding more integrations and creating more features.
Kogno is released under the MIT License.
Read the full the documentation at http://docs.kogno.io.
Also you can download the source code of the flight reservation demo app written in Kogno.