XmppFlask is considered to be simple (it might be not there yet, but we are constantly working no it).

So let’s begin with “hello world” app.



We use PyPy interpreter to run things, but you may want to use standard CPython instead.

Installing pypy

Go to , download latest pypy, unpack it somewhere and make

sudo ln -s /absolute/path/to/pypy/bin/pypy /usr/local/bin/pypy

Now create a virtual environment for you application. First install latest virtualenv to do that:

sudo easy_install --upgrade virtualenv

Then create an environment:

mkdir ~/v
virtualenv -p /usr/local/bin/pypy ~/v/ping-env

Now go ahead and activate that environment:

source ~/v/ping-env/bin/activate

From now on you can install things and they will only harm your virtual environment.

Installing XmppFlask

Right now the simplest way is just to clone the source repository

hg clone
cd xmppflask
python install

Writing simple application

cd to your project’s folder (like ~/workspace/pingpong and write file called

# -*- coding: utf-8 -*-

from xmppflask import XmppFlask
app = XmppFlask(__name__)

def ping():
    return u'pong'

This small app responses “pong” to every “ping” message it gets. Now we need to run that somehow.

If you have setuptools package installed the simplest way to run your XMPPWSGI app would be using xmppflask console script. The other way to run your app is python path/to/xmppflask/ - xmppflask is just handy shortcut.

xmppflask --jid \
--password isecretlyusedjango ./


You need to already have jabber account with that strange password.


Passing JID and his password as command line arguments may be not very secure idea. As alternative solution, you could set them via XMPPFLASK_JID and XMPPFLASK_PASSWORD environment variables. Also you may skip this arguments - they will be asked to be prompted from tty.

Now run that and you should see something like this:

(xmpp)kost@kost-narwhal:~/workspace/pingpong$ xmppflask \
--jid --password isecretlyusedjango ./
WARNING:root:Unable to establish secure connection - TLS failed!
INFO:root:> bot started!

Now go ahead and write something to our bot. Pidgin can be your friend!

_images/pidgin.png _images/xmppflask_talk_ping.png

Great! Now you can go to Overview page and see what else is there.