Using Slack with Weechat, through ZNCWednesday, February 08, 2017
I set this up 2 years ago, but today I had to add another Slack network to add, and it took me an hour to figure out. The connection to ZNC was working fine, but when ZNC was trying to connect to the Slack server, I always got "Invalid user name or password" from slackbot. Slack doesn't explicitly tell you, but the username it gives you is supposed to be your nickname, and your ident, and you have to set this up before making a connection attempt.
If you go to your gateway settings page, you get the following information:
Host: myteam.irc.slack.com User: MySlackUser Pass: MySlackPassword
So what you have to do is, message your bouncer to add a new network:
/msg *status addnetwork myteam
Then connect to the newly added network in ZNC, and add the Slack server to it:
/server add myteam myznc.com +ssl -password=ZNCUsername/myteam:ZNCPassword /connect myteam /msg *status addserver myteam.irc.slack.com +6667 MySlackPassword
At this point ZNC will automatically try to connect, and it will blocked by slackbot, saying "Invalid user name or password". Now comes the magic sauce:
/msg *status disconnect /msg *status saveconfig
saveconfig is important, ZNC keeps your settings in memory, and only flushes it to disk when instructed. Now you SSH into your server where ZNC is running (or you can use the web interface), and you change your nickname, and your ident for the server to match the username that you got on the Slack gateway page. Open
~/.znc/config, and find your network:
<Network myteam> ... Ident = MySlackUser Nick = MySlackUser ... </Network>
After saving the file, reload the ZNC config:
/msg *status rehash /msg *status connect
It should connect now.