Skip to content

Running interactive bots

Zulip’s API has a powerful framework for interactive bots that react to messages in Zulip. You can write and run a custom bot, or run an existing compatible bot.

You’ll need:

  • An account in your organization with permission to create a bot. Ask your administrator or service operator for a test organization if needed.
  • A computer where you’re running the bot from.
  1. Create a bot, making sure to select Generic bot as the Bot type.

  2. Download the bot’s perorc file.

  3. Create and activate an isolated Python environment, then install the zulip_bots Python package:

    python3 -m venv .venv
    source .venv/bin/activate
    python -m pip install zulip_bots
  4. Use the following command to start the bot process (replacing <bot-name> with the bot’s name from the bot examples and ~/path/to/perorc with the path to the perorc file you downloaded above):

    zulip-run-bot <bot-name> --config-file ~/path/to/perorc
  5. Check the output of the command above to make sure your bot is running. It should include the following line:

    INFO:root:starting message handling...
  6. Test your setup by starting a new direct message with the bot or mentioning the bot at the beginning of a channel message.

You can now play around with the bot and get it configured the way you like. Eventually, you’ll probably want to run it in a production environment where it’ll stay up, by deploying it on a server using zulip-botserver.