Skip to content
🔩 IRC to HipChat Relay Daemon - Log all messages from an IRC channel to a HipChat room
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
config.yml
irc2hipchat.god
irc2hipchat.rb

README.md

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.

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

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

  3. Bundle install

    bundle install
  4. Start the daemon

    bundle exec rake start

    Windows Users: Until this PR is finished and merged, run the following in a terminal instead:

    ruby irc2hipchat.rb
    

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

You can’t perform that action at this time.