Botz 1.2.0 Documentation

A common way of creating a new XMPP service is to develop a plugin that will serve the service as a subdomain. That said, if Openfire's domain is programmers would develop the new service as an internal or external component and deploy it as

Botz library is strictly internal for Openfire. The notion of a user connection doesn't involve any TCP/IP or socket; hence virtual. There isn't even a C2S implementation.

Botz Classes:

Botz library contains BotzConnection class that allows a user bot to login as a registered or anonymous user. The class optionally automates the creation and registration of the user bot if it has not existed in the database. To make the user bot useful, programmers would implement BotzPacketReceiver interface to respond to received packets. BotzPacketReceiver.processIncomingPacket(Packet) will be called for every packet received by the user bot. To send packets to other XMPP entities, programmers in turn call BotzConnection.sendPacket(Packet).

Botz classes may be used in situations where an internal user bot is needed. Botz most likely proves itself useful in the development of Openfire extensions through plugins.

Key Features

  • Login anonymously
  • Login as an existing Openfire user
  • Optionally create a new user as a registered user (bot) if it does not exist. The newly created user account will be stored in the database. Because user creation is done using SQL statements internal to Openfire, this should work for all Openfire-supported databases.
  • The above features hide programmers from handling the connection establishment and allow programmers to focus on packet exchanges.
  • Change BotPacketReceiver on the fly, thus switch behaviors and create multiple personalities of a bot.

Using Botz in A Plugin

The following is the code snippet that shows a way to use Botz classes in a plugin. The sample plugin is a parrot bot service that simply echoes packets back to the sender.

import org.igniterealtime.openfire.botz.BotzConnection;
import org.igniterealtime.openfire.botz.BotzPacketReceiver;

public class ParrotBot implements Plugin
    public void destroyPlugin() {}

    public void initializePlugin(PluginManager manager, File pluginDirectory)
        BotzPacketReceiver packetReceiver = new BotzPacketReceiver() {
            BotzConnection bot;

            public void initialize(BotzConnection bot) {
       = bot;

            public void processIncoming(Packet packet) {
                if (packet instanceof Message) {
                    // Echo back to sender
            public void processIncomingRaw(String rawText) { };

            public void terminate() { };

        BotzConnection bot = new BotzConnection(packetReceiver);
        try {
            // Create user and login
            Presence presence = new Presence();
        } catch (Exception e) {


The Botz library is not a plugin in itself, and does not contain any plugin-related class. It is meant for use in an application development.

To use the library in an Openfire plugin, it needs to be defined as a dependency of your plugin project. The dependency can be obtained from Ignite's Maven repository, as shown in this snippet of a pom.xml file:


        <name>Ignite Realtime Repository</name>

Guus Guus Won't tell us where he's from, but says he's from the 'Nether Lands' ... wait that's a real country?

Latest Build 1.2.0
License Open Source Apache
Platforms Openfire