How to write your own Zulip bot

Zulip is an open-source group chat application used by various open-source organizations which give a tough competition to slack.

Zulip uses python and java API for providing back-end for developers to develop in zulip realm. the complete zulip documentation for setup can be found here how to setup zulip development environment on ubuntu 18.04

To set up the development environment for creating a Zulip bot, you need to clone the python-zulip-api repository. Follow the steps to set up the environment.

  1. Clone the python-zulip-api repository.
    git clone
  2. Change directory to the cloned repository.
    cd python-zulip-api
  3. Make sure you have in the right directory and use the below commands to start the development environment
  4. Finally activate the virtual environment by using the below command
    source zulip-api-py3-venv/bin/activate

you need to files in a folder to run your bot 1] file 2] .zuliprc file in a folder.

1] install the necessary file such as pprint, zulip, sys, re, json, httplib2, os using pip install command

2]import required files into your file according to your needs.

3]BOT_MAIL = “<your chat-bot name>@<organisation name>”

4] defining the main part of bot that is constructor function Inside the class, define constructor function __init__. This will contain the details about the client, calling the subscribe_all() function and an array that will contain all the keywords to look out for.this will look for required arrays.

5] the main function: in the main function an object of class ZulipBot will be created and this will call bot.

For running bot and testing the bot's output follow the tutorial

hope this will help you !!

Suraj Patil


open source dev