Slack API: channels, groups, IMs

I’m writing a fancy Slack bot to post messages in a Slack for 500+ users. Fun!

There are at least three different kinds of things a Slack bot can post to:

  • Channels. These are the public channels like #general. Find them with channels.list. Bots can’t call channels.join; I think they’re de facto members of all public channels.
  • Groups. These are private channels. The bot has to be invited via /invite, then it can see the group IDs with channels.list.
  • IMs. These are direct messages. You can see all of a bot’s IMs with im.list. I think someone has to message a bot first before the IM channel is created, not sure how a bot can initiate an IM (if at all).

I mostly like the Slack API but it’s a bit warty for things like this. My impression is it’s grown organically and they’ve never gone through and deprecated old stuff. It’s nice that old code keeps working, but it’s a bit confusing if you’re starting now. I’m also really confused about the various kinds of integrations, bots, applications, etc.