Irc2hipchat

IRC to HipChat Relay Daemon - Log all messages from an IRC channel to a HipChat room

This project is maintained by pglombardo

IRC2HipChat

Log all messages from an IRC channel to a HipChat room.

IRC2HipChat is a short Ruby script that uses Cinch to monitor IRC and re-post messages to a dedicated HipChat room using the HipChat API gem.

  on :channel do |m|
    msg = "<em>#{m.user.nick}</em>: #{m.message}"
    $hipchat.send('irc2hipchat', msg, { :notify => true, :message_format => 'html' })
  end

Note: For now, this is a one way flow of traffic: To use a HipChat room to log IRC channel history. I may pursue a full two-way IRC-to-HipChat bridge eventually but there are some complications to be addressed when trying to match HipChat users to IRC users. TBD

It uses Godrb by default for daemonization and monitoring but you really could use any daemon spawning method you prefer.

Background

AppNeta hosts the #appneta channel on Freenode where we offer user support and answer questions. Not as widely known, is that it's a great place to get direct chat time with the appneta team behind the scenes. On a normal day, we have developers, sales, support and some executives all logged into IRC.

Internally we use HipChat and Dan Riti setup this bot so if someone types 'helpme' a notification gets sent to HipChat to ping the team that someone needs help in IRC. It works great.

My problem was that when I forgot to boot LimeChat for Mac, I would log in and have zero chat history. I know I should instead have a dedicated $5 VM running screen and irssi somewhere but I just don't have the interest and I especially don't like screen. So what's the logical next step? Leverage some existing Ruby gems to create an IRC to HipChat Relay in about 25 lines of code.

How it Looks

irc2hipchat preview

How to Use It

  1. Got Ruby? Checkout rbenv if you don't.

  2. Clone the repository

    git clone https://github.com/pglombardo/IRC2HipChat.git
    
  3. Set your environment variables

      # Get your HipChat api token: http://www.hipchat.com/account/api
      # or even better use a labeled Room Notification Token for better presentation
      echo "export HIPCHAT_API_TOKEN=xxx" >> ~/.bash_profile
    

    Ubuntu Desktop note: Modify your ~/.bashrc instead of ~/.bash_profile.

    Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.

  4. Configure your HipChat room and IRC channel in config.yml

    ---
    HipChatRoom: AppNetaIRCLog
    IRCChannel: '#appneta'
    IRCServer: irc.freenode.org
    IRCNick: irc2hipchat
    
  5. Restart your shell so the new environment variables take affect

  6. Bundle install

    bundle install
    
  7. Start the daemon

    bundle exec rake start
    

Monitoring and Performance

Being AppNeta, we like to monitor performance of all things. If you don't have a TraceView account, sign up. It's free.

If you have TraceView setup and installed on your host, IRC2HipChat will automatically report statistics to your dashboard.

irc2hipchat traces