title: How can a Slack bot detect a direct message vs a message in a channel?
body: <p>TL;DR: Via the Slack APIs, how can I differentiate between a message in a channel vs a direct message?</p>
  
  <p>I have a working Slack bot using the RTM API, let's call it Edi.  And it works great as long as all commands start with "@edi"; e.g. "@edi help".  It currently responses to any channel it's a member of and direct messages.  However, I'd like to update the bot so that when it's a direct message, there won't be a need to start a command with "@edi"; e.g. "@edi help" in a channel, but "help" in a direct message.  I don't see anything specific to differentiate between the two, but I did try using the channel.info endpoint and counting the number of people in "members"; however, this method only works on public channel.  For private channels and direct messages, the endpoint returns an "channel_not_found" error.</p>
  
  <p>Thanks in advance.</p>