Phergie Slack setup and configuration

Ever since the rise of Slack and the Phergie v3 connecting them has been on my to do list. And while Slack API is the better alternative this was fun nontheless.

Set up the IRC gateway

Slack has an IRC gateway we'll be using to connect to it. Assuming you're the slacks admin, go to my.slack.com/admin/settings and enable it under Permissions ->Gateways. While it is possible it is recommended not to use the non-ssl server and leave it disabled.

Create a user for the bot

Now create a user for the bot, but not that it can't be a bot account as defined in the admin it has to be a normal user. (Bot accounts can't connect to the IRC gateway.)

Look up IRC details

Once you've created the new user go to my.slack.com/account/gateways as that user and lookup the host, user, and pass values. Lets say they are for the rest of the examples:

  • Host: myawesomeslack.irc.slack.com
  • User: everythingisawesome
  • Pass: iwehrihwoifhoqiweiwhvwdivqwe
Defining a connection

Configure the connection as follows and you're Phergie bot will connect to your Slack instead of a regular IRC server:

new Connection([
    'serverHostname'    => 'myawesomeslack.irc.slack.com',
    'serverPort'        => 6697,
    'username'          => 'everythingisawesome',
    'realname'          => 'everythingisawesome',
    'nickname'          => 'everythingisawesome',
    'password'          => 'iwehrihwoifhoqiweiwhvwdivqwe',
    'options'           => [
        'transport'     => 'ssl',

Connecting Phergie to Slack was surprisingly easier then expected. And it gives you a fully functional Phergie bot on your slack:

Phergie on Slack

Categories: PHP - Phergie - ReactPHPTags: PHP - Phergie - ReactPHP - IRC