Configuring errbot presence in HipChat

312 Views Asked by At

I'm trying to use Errbot with HipChat server (not cloud). It looks like Errbot is confused between a room name and its xmpp jid. For example, testing with room named BotTest that has jid of [email protected]:

  • When I set CHATROOM_PRESENCE to the room name and send any message in that room, Errbot crashes with the error "Room '[email protected]' not found".
  • When I set it instead to the room's jid, Errbot creates a new room with the same name as the jid, and a jid of '[email protected]'. Then when I send a message in that new room it crashes with the error "Room '[email protected]' not found".

My config.py is below:

import logging
BACKEND = 'XMPP'  # defaults to XMPP
BOT_DATA_DIR = r'/auto/home.nas03/eeshel/work/errbot/data'
BOT_EXTRA_PLUGIN_DIR = '/auto/home.nas03/eeshel/work/errbot/plugins'
BOT_LOG_FILE = r'/auto/home.nas03/eeshel/work/errbot/errbot.log'
BOT_LOG_LEVEL = logging.DEBUG
TEXT_COLOR_THEME = 'dark'
BOT_ADMINS = ('[email protected]', )
BOT_PREFIX = '\\'
BOT_ALT_PREFIXES = ('Hermes',)
BOT_ALT_PREFIX_SEPARATORS = (':', ',', ';')
BOT_ALT_PREFIX_CASEINSENSITIVE = True
CHATROOM_FN = 'Hermes the Bot'
CHATROOM_PRESENCE = ('[email protected]',)
BOT_IDENTITY = {
    'username' : '[email protected].<ourdomain>',
    'password' : '*****',
    'token'    : '*****',
    'endpoint' : '10.18.0.185',
}
XMPP_KEEPALIVE_INTERVAL = 60
XMPP_USE_IPV6 = False
XMPP_CA_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt"
2

There are 2 best solutions below

2
On

You can refer below link ,which will help you http://errbot.io/en/latest/user_guide/configuration/hipchat.html

0
On

While the documentation is very good, I also struggled to get these things just right. Once I did, a re-read of the doc makes sense, but hindsight is 20/20!

Here is an example config section to have your errbot connect to Hipchat:

# Assuming you are @jdoe in your Hipchat and you want admin privs for your bot
BOT_ADMINS = ('@jdoe', '@mmouse', )

# Let's assume your bot's Hipchat account is "superbot" with
# full name of "Super Bot"
BACKEND = 'Hipchat'
if BACKEND == 'Hipchat':
    # http://errbot.io/en/latest/user_guide/configuration/hipchat.html
    BOT_IDENTITY = {
        # You get username by logging into Hipchat with the account, then go to
        # Profile / XMPP/Jabber Info and find the "Jabber ID"
        'username': '[email protected]',

        # Simply the password of the Hipchat account
        'password': 'password12345',

        # You get token by logging into Hipchat with the account, then go to
        # Profile / API Access and generate an API token--assigning it all
        # scopes unless you know otherwise.
        'token': 'azwx2BdVzGz0riEjqybWinLbUkBSIz6rpsa259HE',

        ## If you're using HipChat server (self-hosted HipChat) then you should set
        ## the endpoint below. If you don't use HipChat server but use the hosted version
        ## of HipChat then you may leave this commented out.
        #'endpoint': 'https://api.hipchat.com'
    }

    CHATROOM_FN = 'Super Bot'
    BOT_ALT_PREFIXES = ('@superbot', '@SuperBot', '@stinkfinger',)
    # To "listen" for any mentions of @superbot:
    CHATROOM_PRESENCE = ()
    # To also join rooms to listen to all messages in those rooms,
    # do this instead:
    #CHATROOM_PRESENCE = ('Room 1', 'Lounge',)

IMPORTANT also to note that I had to downgrade these packages to get Hipchat integration working. I made these changes in my requirements.txt:

pyasn1==0.3.7
pyasn1-modules==0.1.5
sleekxmpp==1.3.2