Bottoku, Micro Framework for Chat/Messenger Bots
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example Prepare READMEs May 29, 2016


bottoku - Python Chat/Messenger Bot Microframework

bottoku(pronounced as bot-oku) is a chat bot micro framework for Pythonista.


bottoku is a microframework, however, you can build chat bots without restriction.

For example,

  • Integration with web frameworks e.g. flask, django, etc...
  • Serverless bots running on AWS Lambda
  • Building messages compatible with Line, Facebook, and Slack
  • Messages with attachments e.g. images, videos, etc...
  • Conversations with contexts: hi! -> who r u? -> john -> hi john, how about...
  • Favorite database backend

Compared to Hubot

  • No built-in server. If you want to build non-serverless bots, choose favorite web frameworks.
  • No built-in binary. bottoku is just a library, so please do pip install to integrate.
  • Very flexible routing system. Conditions are not defined by regex, but by Python's lambda functions.
  • And of course, bottoku is a Python framework.


First, pip it.:

pip install bottoku

Then, define actions and views:

from bottoku.api.facebook.template import TextMessage
def greeting():  # view is just a function to return a list of messages
    return [TextMesage(text='hello, i am a bot')]

from bottoku import route
@route(lambda message, context: 'hello' in message)  # lambda condition to reply
def say_hello(render, message, context):
    render(greeting())  # call `render` function

Next, define a bot class (application class), it is used to define routes and API clients.:

from bottoku import Bot
from bottoku.renderer.stdout import StdoutRenderer
from bottoku.api.facebook.renderer import FacebookRenderer
class MyBot(Bot):
    def __init__(self, env):
        super(MyBot, self).__init__(
              # other actions...
          BlackholeRepository(),  # repository to set user's data
          ]  # API clients

Finally, instantiate the bot and call reply in handler.:

#, lambda handler or web frameworks' webhook handler
def handler():
    message, receiver_id = extract_from_message()
    bot = MyBot(env)
    bot.reply(message, receiver_id)

Currently, I have not prepared docs yet. But you can see examples.


  • example: most basic example
  • example_api: advanced example to use Facebook and Slack APIs

Bugs / Feature requests

Github's issue or mention to @yamitzky