Interactive bots

Zulip's API has a powerful framework for interactive bots that react to messages in Zulip.

Running a bot

This guide will show you how to run an existing Zulip bot found in zulip_bots/bots.

You'll need:

Note: Please be considerate when testing experimental bots on public servers such as chat.zulip.org.

  1. Create a bot, making sure to select Generic bot as the Bot type.

  2. Download the bot's zuliprc file.

  3. Use the following command to install the zulip_bots Python package:

    pip3 install zulip_bots
    
  4. Use the following command to start the bot process (replacing ~/path/to/zuliprc with the path to the zuliprc file you downloaded above):

    zulip-run-bot <bot-name> --config-file ~/path/to/zuliprc
    
  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 on a channel.

To use the latest development version of the zulip_bots package, follow these steps.

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 the Zulip Botserver.

Common problems

  • My bot won't start
    • Ensure that your API config file is correct (download the config file from the server).
    • Ensure that your bot script is located in zulip_bots/bots/<my-bot>/
    • Are you using your own Zulip development server? Ensure that you run your bot outside the Vagrant environment.
    • Some bots require Python 3. Try switching to a Python 3 environment before running your bot.